better-call 1.1.4 → 1.1.6
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/README.md +209 -110
- package/dist/client.cjs +7 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +3 -2
- package/dist/client.d.ts +3 -2
- package/dist/client.js +2 -1
- package/dist/client.js.map +1 -1
- package/dist/error.cjs +8 -0
- package/dist/error.d.cts +2 -0
- package/dist/error.d.ts +2 -0
- package/dist/error.js +3 -0
- package/dist/error2.cjs +171 -0
- package/dist/error2.cjs.map +1 -0
- package/dist/error2.d.cts +157 -0
- package/dist/error2.d.ts +157 -0
- package/dist/error2.js +135 -0
- package/dist/error2.js.map +1 -0
- package/dist/index.cjs +27 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -134
- package/dist/index.js.map +1 -1
- package/dist/node.cjs.map +1 -1
- package/dist/node.js.map +1 -1
- package/dist/router.d.cts +9 -156
- package/dist/router.d.ts +9 -156
- package/package.json +22 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Better Call
|
|
2
2
|
|
|
3
|
-
Better call is a tiny web framework for creating endpoints that can be invoked as a normal function or mounted to a router to be served by any web standard compatible server (like Bun, node, nextjs, sveltekit...) and also includes a typed RPC client for
|
|
3
|
+
Better call is a tiny web framework for creating endpoints that can be invoked as a normal function or mounted to a router to be served by any web standard compatible server (like Bun, node, nextjs, sveltekit...) and also includes a typed RPC client for type-safe client-side invocation of these endpoints.
|
|
4
4
|
|
|
5
5
|
Built for typescript and it comes with a very high performance router based on [rou3](https://github.com/unjs/rou3).
|
|
6
6
|
|
|
@@ -21,10 +21,11 @@ pnpm i zod
|
|
|
21
21
|
The building blocks for better-call are endpoints. You can create an endpoint by calling `createEndpoint` and passing it a path, [options](#endpointoptions) and a handler that will be invoked when the endpoint is called.
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
|
-
|
|
24
|
+
// endpoint.ts
|
|
25
|
+
import { createEndpoint } from "better-call"
|
|
25
26
|
import { z } from "zod"
|
|
26
27
|
|
|
27
|
-
const createItem = createEndpoint("/item", {
|
|
28
|
+
export const createItem = createEndpoint("/item", {
|
|
28
29
|
method: "POST",
|
|
29
30
|
body: z.object({
|
|
30
31
|
id: z.string()
|
|
@@ -43,6 +44,8 @@ const item = await createItem({
|
|
|
43
44
|
id: "123"
|
|
44
45
|
}
|
|
45
46
|
})
|
|
47
|
+
|
|
48
|
+
console.log(item); // { item: { id: '123' } }
|
|
46
49
|
```
|
|
47
50
|
|
|
48
51
|
OR you can mount the endpoint to a router and serve it with any web standard compatible server.
|
|
@@ -50,7 +53,11 @@ OR you can mount the endpoint to a router and serve it with any web standard com
|
|
|
50
53
|
> The example below uses [Bun](https://bun.sh/)
|
|
51
54
|
|
|
52
55
|
```ts
|
|
53
|
-
|
|
56
|
+
// router.ts
|
|
57
|
+
import { createRouter } from "better-call"
|
|
58
|
+
import { createItem } from "./endpoint"
|
|
59
|
+
|
|
60
|
+
export const router = createRouter({
|
|
54
61
|
createItem
|
|
55
62
|
})
|
|
56
63
|
|
|
@@ -62,101 +69,21 @@ Bun.serve({
|
|
|
62
69
|
Then you can use the rpc client to call the endpoints on client.
|
|
63
70
|
|
|
64
71
|
```ts
|
|
65
|
-
//client.ts
|
|
72
|
+
// client.ts
|
|
66
73
|
import type { router } from "./router" // import router type
|
|
67
|
-
import { createClient } from "better-call/client"
|
|
74
|
+
import { createClient } from "better-call/client"
|
|
68
75
|
|
|
69
76
|
const client = createClient<typeof router>({
|
|
70
77
|
baseURL: "http://localhost:3000"
|
|
71
|
-
});
|
|
72
|
-
const items = await client("/item", {
|
|
73
|
-
body: {
|
|
74
|
-
id: "123"
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Returning non 200 responses
|
|
80
|
-
|
|
81
|
-
There are several supported ways to a non 200 response:
|
|
82
|
-
|
|
83
|
-
You can use the `ctx.setStatus(status)` helper to change the default status code of a successful response:
|
|
84
|
-
|
|
85
|
-
```ts
|
|
86
|
-
const createItem = createEndpoint("/item", {
|
|
87
|
-
method: "POST",
|
|
88
|
-
body: z.object({
|
|
89
|
-
id: z.string()
|
|
90
|
-
})
|
|
91
|
-
}, async (ctx) => {
|
|
92
|
-
ctx.setStatus(201);
|
|
93
|
-
return {
|
|
94
|
-
item: {
|
|
95
|
-
id: ctx.body.id
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
78
|
})
|
|
99
|
-
```
|
|
100
79
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const createItem = createEndpoint("/item", {
|
|
105
|
-
method: "POST",
|
|
106
|
-
body: z.object({
|
|
107
|
-
id: z.string()
|
|
108
|
-
})
|
|
109
|
-
}, async (ctx) => {
|
|
110
|
-
if(ctx.body.id === "123") {
|
|
111
|
-
throw ctx.error("Bad Request", {
|
|
112
|
-
message: "Id is not allowed"
|
|
113
|
-
})
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
item: {
|
|
117
|
-
id: ctx.body.id
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
})
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
You can also instead throw using a status code:
|
|
124
|
-
|
|
125
|
-
```ts
|
|
126
|
-
const createItem = createEndpoint("/item", {
|
|
127
|
-
method: "POST",
|
|
128
|
-
body: z.object({
|
|
129
|
-
id: z.string()
|
|
130
|
-
})
|
|
131
|
-
}, async (ctx) => {
|
|
132
|
-
if(ctx.body.id === "123") {
|
|
133
|
-
throw ctx.error(400, {
|
|
134
|
-
message: "Id is not allowed"
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
item: {
|
|
139
|
-
id: ctx.body.id
|
|
140
|
-
}
|
|
80
|
+
const item = await client("@post/item", {
|
|
81
|
+
body: {
|
|
82
|
+
id: "123"
|
|
141
83
|
}
|
|
142
84
|
})
|
|
143
|
-
```
|
|
144
85
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
```ts
|
|
148
|
-
const createItem = createEndpoint("/item", {
|
|
149
|
-
method: "POST",
|
|
150
|
-
body: z.object({
|
|
151
|
-
id: z.string()
|
|
152
|
-
})
|
|
153
|
-
}, async (ctx) => {
|
|
154
|
-
return Response.json({
|
|
155
|
-
item: {
|
|
156
|
-
id: ctx.body.id
|
|
157
|
-
}
|
|
158
|
-
}, { status: 201 });
|
|
159
|
-
})
|
|
86
|
+
console.log(item) // { data: { item: { id: '123' } }, error: null }
|
|
160
87
|
```
|
|
161
88
|
|
|
162
89
|
### Endpoint
|
|
@@ -168,12 +95,12 @@ Endpoints are building blocks of better-call.
|
|
|
168
95
|
The path is the URL path that the endpoint will respond to. It can be a direct path or a path with parameters and wildcards.
|
|
169
96
|
|
|
170
97
|
```ts
|
|
171
|
-
//direct path
|
|
98
|
+
// direct path
|
|
172
99
|
const endpoint = createEndpoint("/item", {
|
|
173
100
|
method: "GET",
|
|
174
101
|
}, async (ctx) => {})
|
|
175
102
|
|
|
176
|
-
//path with parameters
|
|
103
|
+
// path with parameters
|
|
177
104
|
const endpoint = createEndpoint("/item/:id", {
|
|
178
105
|
method: "GET",
|
|
179
106
|
}, async (ctx) => {
|
|
@@ -184,18 +111,18 @@ const endpoint = createEndpoint("/item/:id", {
|
|
|
184
111
|
}
|
|
185
112
|
})
|
|
186
113
|
|
|
187
|
-
//path with wildcards
|
|
114
|
+
// path with wildcards
|
|
188
115
|
const endpoint = createEndpoint("/item/**:name", {
|
|
189
116
|
method: "GET",
|
|
190
117
|
}, async (ctx) => {
|
|
191
|
-
//the name will be the remaining path
|
|
118
|
+
// the name will be the remaining path
|
|
192
119
|
ctx.params.name
|
|
193
120
|
})
|
|
194
121
|
```
|
|
195
122
|
|
|
196
123
|
#### Body Schema
|
|
197
124
|
|
|
198
|
-
The `body` option accepts a standard schema and will validate the request body. If the request body doesn't match the schema, the endpoint will throw
|
|
125
|
+
The `body` option accepts a standard schema and will validate the request body. If the request body doesn't match the schema, the endpoint will throw a validation error. If it's mounted to a router, it'll return a 400 error with the error details.
|
|
199
126
|
|
|
200
127
|
```ts
|
|
201
128
|
const createItem = createEndpoint("/item", {
|
|
@@ -214,7 +141,7 @@ const createItem = createEndpoint("/item", {
|
|
|
214
141
|
|
|
215
142
|
#### Query Schema
|
|
216
143
|
|
|
217
|
-
The `query` option accepts a standard schema and will validate the request query. If the request query doesn't match the schema, the endpoint will throw
|
|
144
|
+
The `query` option accepts a standard schema and will validate the request query. If the request query doesn't match the schema, the endpoint will throw a validation error. If it's mounted to a router, it'll return a 400 error with the error details.
|
|
218
145
|
|
|
219
146
|
```ts
|
|
220
147
|
const createItem = createEndpoint("/item", {
|
|
@@ -231,12 +158,28 @@ const createItem = createEndpoint("/item", {
|
|
|
231
158
|
})
|
|
232
159
|
```
|
|
233
160
|
|
|
161
|
+
#### Media types
|
|
162
|
+
|
|
163
|
+
By default, all media types are accepted, but only a handful of them have a built-in support:
|
|
164
|
+
|
|
165
|
+
- `application/json` and [custom json suffixes](https://datatracker.ietf.org/doc/html/rfc6839#section-3.1) are parsed as a JSON (plain) object
|
|
166
|
+
- `application/x-www-form-urlencoded` and `multipart/form-data` are parsed as a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) object
|
|
167
|
+
- `text/plain` is parsed as a plain string
|
|
168
|
+
- `application/octet-stream` is parsed as an [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)
|
|
169
|
+
- `application/pdf`, `image/*` and `video/*` are parsed as [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
170
|
+
- `application/stream` is parsed as [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)
|
|
171
|
+
- Any other media type that is not recognized, will be parsed as a plain string.
|
|
172
|
+
|
|
173
|
+
Similarly, returning a supported type from a handler will properly serialize it with the correct `Content-Type` as specified above.
|
|
174
|
+
|
|
234
175
|
#### Allowed Media Types
|
|
235
176
|
|
|
236
177
|
You can restrict which media types (MIME types) are allowed for request bodies using the `allowedMediaTypes` option. This can be configured at both the router level and the endpoint level, with endpoint-level configuration taking precedence.
|
|
237
178
|
|
|
238
179
|
When a request is made with a disallowed media type, the endpoint will return a `415 Unsupported Media Type` error.
|
|
239
180
|
|
|
181
|
+
> *Note*: Please note that using this option won't add parsing support for new media types, it only restricts the media types that are already supported.
|
|
182
|
+
|
|
240
183
|
**Router-level configuration:**
|
|
241
184
|
|
|
242
185
|
```ts
|
|
@@ -309,13 +252,6 @@ const uploadFile = createEndpoint("/upload", {
|
|
|
309
252
|
})
|
|
310
253
|
```
|
|
311
254
|
|
|
312
|
-
Common media types:
|
|
313
|
-
- `application/json` - JSON data
|
|
314
|
-
- `application/x-www-form-urlencoded` - Form data
|
|
315
|
-
- `multipart/form-data` - File uploads
|
|
316
|
-
- `text/plain` - Plain text
|
|
317
|
-
- `application/octet-stream` - Binary data
|
|
318
|
-
|
|
319
255
|
> **Note:** The validation is case-insensitive and handles charset parameters automatically (e.g., `application/json; charset=utf-8` will match `application/json`).
|
|
320
256
|
|
|
321
257
|
#### Require Headers
|
|
@@ -361,13 +297,176 @@ createItem({
|
|
|
361
297
|
|
|
362
298
|
### Handler
|
|
363
299
|
|
|
364
|
-
|
|
300
|
+
This is the function that will be invoked when the endpoint is called. The signature is:
|
|
301
|
+
|
|
302
|
+
```ts
|
|
303
|
+
const handler = async (ctx) => response;
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Where `ctx` is:
|
|
307
|
+
|
|
308
|
+
- The context object containing the `request`, `headers`, `body`, `query`, `params` and a few helper functions. If there is a middleware, the context will be extended with the middleware context.
|
|
309
|
+
|
|
310
|
+
And `response` is any supported response type:
|
|
311
|
+
|
|
312
|
+
- a `Response` object
|
|
313
|
+
- any javascript value: `string`, `number`, `boolean`, an `object` or an `array`
|
|
314
|
+
- the return value of the `ctx.json()` helper
|
|
315
|
+
|
|
316
|
+
Below, we document all the ways in which you can create a response in your handler:
|
|
365
317
|
|
|
366
|
-
|
|
318
|
+
#### Returning a response
|
|
367
319
|
|
|
368
|
-
|
|
320
|
+
You can use the `ctx.setStatus(status)` helper to change the default status code of a successful response:
|
|
321
|
+
|
|
322
|
+
```ts
|
|
323
|
+
const createItem = createEndpoint("/item", {
|
|
324
|
+
method: "POST",
|
|
325
|
+
body: z.object({
|
|
326
|
+
id: z.string()
|
|
327
|
+
})
|
|
328
|
+
}, async (ctx) => {
|
|
329
|
+
ctx.setStatus(201);
|
|
330
|
+
return {
|
|
331
|
+
item: {
|
|
332
|
+
id: ctx.body.id
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
})
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Sometimes, you want to respond with an error, in those cases you will need to throw better-call's `APIError` error or use the `ctx.error()` helper, they both have the same signatures!
|
|
339
|
+
If the endpoint is called as a function, the error will be thrown but if it's mounted to a router, the error will be converted to a response object with the correct status code and headers.
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
import { APIError } from "better-call"
|
|
343
|
+
|
|
344
|
+
const createItem = createEndpoint("/item", {
|
|
345
|
+
method: "POST",
|
|
346
|
+
body: z.object({
|
|
347
|
+
id: z.string()
|
|
348
|
+
})
|
|
349
|
+
}, async (ctx) => {
|
|
350
|
+
if (ctx.body.id === "123") {
|
|
351
|
+
throw ctx.error("BAD_REQUEST", {
|
|
352
|
+
message: "Id is not allowed"
|
|
353
|
+
})
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (ctx.body.id === "456") {
|
|
357
|
+
throw new APIError("BAD_REQUEST", {
|
|
358
|
+
message: "Id is not allowed"
|
|
359
|
+
})
|
|
360
|
+
}
|
|
361
|
+
return {
|
|
362
|
+
item: {
|
|
363
|
+
id: ctx.body.id
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
})
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
You can also instead throw using a status code:
|
|
370
|
+
|
|
371
|
+
```ts
|
|
372
|
+
const createItem = createEndpoint("/item", {
|
|
373
|
+
method: "POST",
|
|
374
|
+
body: z.object({
|
|
375
|
+
id: z.string()
|
|
376
|
+
})
|
|
377
|
+
}, async (ctx) => {
|
|
378
|
+
if (ctx.body.id === "123") {
|
|
379
|
+
throw ctx.error(400, {
|
|
380
|
+
message: "Id is not allowed"
|
|
381
|
+
})
|
|
382
|
+
}
|
|
383
|
+
return {
|
|
384
|
+
item: {
|
|
385
|
+
id: ctx.body.id
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
})
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
You can also specify custom response headers:
|
|
392
|
+
|
|
393
|
+
```ts
|
|
394
|
+
const createItem = createEndpoint("/item", {
|
|
395
|
+
method: "POST",
|
|
396
|
+
body: z.object({
|
|
397
|
+
id: z.string()
|
|
398
|
+
})
|
|
399
|
+
}, async (ctx) => {
|
|
400
|
+
if (ctx.body.id === "123") {
|
|
401
|
+
throw ctx.error(
|
|
402
|
+
400,
|
|
403
|
+
{ message: "Id is not allowed" },
|
|
404
|
+
{ "x-key": "value" } // custom response headers
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
return {
|
|
408
|
+
item: {
|
|
409
|
+
id: ctx.body.id
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
})
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
Or create a redirection:
|
|
416
|
+
|
|
417
|
+
```ts
|
|
418
|
+
const createItem = createEndpoint("/item", {
|
|
419
|
+
method: "POST",
|
|
420
|
+
body: z.object({
|
|
421
|
+
id: z.string()
|
|
422
|
+
})
|
|
423
|
+
}, async (ctx) => {
|
|
424
|
+
if (ctx.body.id === "123") {
|
|
425
|
+
throw ctx.redirect("/item/123");
|
|
426
|
+
}
|
|
427
|
+
return {
|
|
428
|
+
item: {
|
|
429
|
+
id: ctx.body.id
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
})
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Or use the `ctx.json()` to return any object:
|
|
436
|
+
|
|
437
|
+
```ts
|
|
438
|
+
const createItem = createEndpoint("/item", {
|
|
439
|
+
method: "POST",
|
|
440
|
+
body: z.object({
|
|
441
|
+
id: z.string()
|
|
442
|
+
})
|
|
443
|
+
}, async (ctx) => {
|
|
444
|
+
return ctx.json({
|
|
445
|
+
item: {
|
|
446
|
+
id: ctx.body.id
|
|
447
|
+
}
|
|
448
|
+
})
|
|
449
|
+
})
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
Finally, you can return a new `Response` object. In this case, the `ctx.setStatus()` call will be ignored, as the `Response` will have completely control over the final status code:
|
|
453
|
+
|
|
454
|
+
```ts
|
|
455
|
+
const createItem = createEndpoint("/item", {
|
|
456
|
+
method: "POST",
|
|
457
|
+
body: z.object({
|
|
458
|
+
id: z.string()
|
|
459
|
+
})
|
|
460
|
+
}, async (ctx) => {
|
|
461
|
+
return Response.json({
|
|
462
|
+
item: {
|
|
463
|
+
id: ctx.body.id
|
|
464
|
+
}
|
|
465
|
+
}, { status: 201 });
|
|
466
|
+
})
|
|
467
|
+
```
|
|
369
468
|
|
|
370
|
-
|
|
469
|
+
> **Note**: Please note that when using the `Response` API, your endpoint will not return the JSON object even if you use the `Response.json()` helper, you'll always get a `Response` as a result.
|
|
371
470
|
|
|
372
471
|
### Middleware
|
|
373
472
|
|
|
@@ -388,7 +487,7 @@ const endpoint = createEndpoint("/", {
|
|
|
388
487
|
method: "GET",
|
|
389
488
|
use: [middleware],
|
|
390
489
|
}, async (ctx) => {
|
|
391
|
-
//this will be the context object returned by the middleware with the name property
|
|
490
|
+
// this will be the context object returned by the middleware with the name property
|
|
392
491
|
ctx.context
|
|
393
492
|
})
|
|
394
493
|
```
|
|
@@ -577,7 +676,7 @@ const items = await client("/item", {
|
|
|
577
676
|
|
|
578
677
|
### Headers and Cookies
|
|
579
678
|
|
|
580
|
-
If you return a response object from an endpoint, the headers and cookies will be set on the response object. But You can
|
|
679
|
+
If you return a response object from an endpoint, the headers and cookies will be set on the response object. But You can set headers and cookies for the context object.
|
|
581
680
|
|
|
582
681
|
```ts
|
|
583
682
|
const createItem = createEndpoint("/item", {
|
|
@@ -614,7 +713,7 @@ const createItem = createEndpoint("/item", {
|
|
|
614
713
|
})
|
|
615
714
|
```
|
|
616
715
|
|
|
617
|
-
>
|
|
716
|
+
> **Note**: The context object also exposes and allows you to interact with signed cookies via the `ctx.getSignedCookie()` and `ctx.setSignedCookie()` helpers.
|
|
618
717
|
|
|
619
718
|
### Endpoint Creator
|
|
620
719
|
|
package/dist/client.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_error = require('./error2.cjs');
|
|
1
2
|
const require_node = require('./node.cjs');
|
|
2
3
|
let __better_fetch_fetch = require("@better-fetch/fetch");
|
|
3
4
|
|
|
@@ -10,5 +11,11 @@ const createClient = (options) => {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
//#endregion
|
|
14
|
+
exports.APIError = require_error.APIError;
|
|
15
|
+
exports.BetterCallError = require_error.BetterCallError;
|
|
16
|
+
exports.ValidationError = require_error.ValidationError;
|
|
13
17
|
exports.createClient = createClient;
|
|
18
|
+
exports.hideInternalStackFrames = require_error.hideInternalStackFrames;
|
|
19
|
+
exports.makeErrorForHideStackFrame = require_error.makeErrorForHideStackFrame;
|
|
20
|
+
exports.statusCodes = require_error.statusCodes;
|
|
14
21
|
//# sourceMappingURL=client.cjs.map
|
package/dist/client.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.cjs","names":["options"],"sources":["../src/client.ts"],"sourcesContent":["import { type BetterFetchOption, type BetterFetchResponse, createFetch } from \"@better-fetch/fetch\";\nimport type { Router } from \"./router\";\nimport type { HasRequiredKeys, Prettify, UnionToIntersection } from \"./helper\";\nimport type { Endpoint } from \"./endpoint\";\n\ntype HasRequired<\n\tT extends {\n\t\tbody?: any;\n\t\tquery?: any;\n\t\tparams?: any;\n\t},\n> = T[\"body\"] extends object\n\t? HasRequiredKeys<T[\"body\"]> extends true\n\t\t? true\n\t\t: T[\"query\"] extends object\n\t\t\t? HasRequiredKeys<T[\"query\"]> extends true\n\t\t\t\t? true\n\t\t\t\t: T[\"params\"] extends object\n\t\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t\t: false\n\t\t\t: T[\"params\"] extends object\n\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t: false\n\t: T[\"query\"] extends object\n\t\t? HasRequiredKeys<T[\"query\"]> extends true\n\t\t\t? true\n\t\t\t: T[\"params\"] extends object\n\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t: false\n\t\t: T[\"params\"] extends object\n\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t: false;\n\ntype InferContext<T> = T extends (ctx: infer Ctx) => any\n\t? Ctx extends object\n\t\t? Ctx\n\t\t: never\n\t: never;\n\nexport interface ClientOptions extends BetterFetchOption {\n\tbaseURL: string;\n}\n\ntype WithRequired<T, K> = T & {\n\t[P in K extends string ? K : never]-?: T[P extends keyof T ? P : never];\n};\n\ntype InferClientRoutes<T extends Record<string, Endpoint>> = {\n\t[K in keyof T]: T[K] extends Endpoint<any, infer O>\n\t\t? O extends\n\t\t\t\t| { metadata: { scope: \"http\" } }\n\t\t\t\t| { metadata: { scope: \"server\" } }\n\t\t\t\t| { metadata: { SERVER_ONLY: true } }\n\t\t\t\t| { metadata: { isAction: false } }\n\t\t\t? never\n\t\t\t: T[K]\n\t\t: T[K];\n};\n\nexport type RequiredOptionKeys<\n\tC extends {\n\t\tbody?: any;\n\t\tquery?: any;\n\t\tparams?: any;\n\t},\n> = (undefined extends C[\"body\"]\n\t? {}\n\t: {\n\t\t\tbody: true;\n\t\t}) &\n\t(undefined extends C[\"query\"]\n\t\t? {}\n\t\t: {\n\t\t\t\tquery: true;\n\t\t\t}) &\n\t(undefined extends C[\"params\"]\n\t\t? {}\n\t\t: {\n\t\t\t\tparams: true;\n\t\t\t});\n\nexport const createClient = <R extends Router | Router[\"endpoints\"]>(options: ClientOptions) => {\n\tconst fetch = createFetch(options);\n\ttype API = InferClientRoutes<\n\t\tR extends { endpoints: Record<string, Endpoint> } ? R[\"endpoints\"] : R\n\t>;\n\ttype Options = API extends {\n\t\t[key: string]: infer T;\n\t}\n\t\t? T extends Endpoint\n\t\t\t? {\n\t\t\t\t\t[key in T[\"options\"][\"method\"] extends \"GET\"\n\t\t\t\t\t\t? T[\"path\"]\n\t\t\t\t\t\t: `@${T[\"options\"][\"method\"] extends string ? Lowercase<T[\"options\"][\"method\"]> : never}${T[\"path\"]}`]: T;\n\t\t\t\t}\n\t\t\t: {}\n\t\t: {};\n\n\ttype O = Prettify<UnionToIntersection<Options>>;\n\treturn async <OPT extends O, K extends keyof OPT, C extends InferContext<OPT[K]>>(\n\t\tpath: K,\n\t\t...options: HasRequired<C> extends true\n\t\t\t? [\n\t\t\t\t\tWithRequired<\n\t\t\t\t\t\tBetterFetchOption<C[\"body\"], C[\"query\"], C[\"params\"]>,\n\t\t\t\t\t\tkeyof RequiredOptionKeys<C>\n\t\t\t\t\t>,\n\t\t\t\t]\n\t\t\t: [BetterFetchOption<C[\"body\"], C[\"query\"], C[\"params\"]>?]\n\t): Promise<\n\t\tBetterFetchResponse<Awaited<ReturnType<OPT[K] extends Endpoint ? OPT[K] : never>>>\n\t> => {\n\t\treturn (await fetch(path as string, {\n\t\t\t...options[0],\n\t\t})) as any;\n\t};\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.cjs","names":["options"],"sources":["../src/client.ts"],"sourcesContent":["import { type BetterFetchOption, type BetterFetchResponse, createFetch } from \"@better-fetch/fetch\";\nimport type { Router } from \"./router\";\nimport type { HasRequiredKeys, Prettify, UnionToIntersection } from \"./helper\";\nimport type { Endpoint } from \"./endpoint\";\n\ntype HasRequired<\n\tT extends {\n\t\tbody?: any;\n\t\tquery?: any;\n\t\tparams?: any;\n\t},\n> = T[\"body\"] extends object\n\t? HasRequiredKeys<T[\"body\"]> extends true\n\t\t? true\n\t\t: T[\"query\"] extends object\n\t\t\t? HasRequiredKeys<T[\"query\"]> extends true\n\t\t\t\t? true\n\t\t\t\t: T[\"params\"] extends object\n\t\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t\t: false\n\t\t\t: T[\"params\"] extends object\n\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t: false\n\t: T[\"query\"] extends object\n\t\t? HasRequiredKeys<T[\"query\"]> extends true\n\t\t\t? true\n\t\t\t: T[\"params\"] extends object\n\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t: false\n\t\t: T[\"params\"] extends object\n\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t: false;\n\ntype InferContext<T> = T extends (ctx: infer Ctx) => any\n\t? Ctx extends object\n\t\t? Ctx\n\t\t: never\n\t: never;\n\nexport interface ClientOptions extends BetterFetchOption {\n\tbaseURL: string;\n}\n\ntype WithRequired<T, K> = T & {\n\t[P in K extends string ? K : never]-?: T[P extends keyof T ? P : never];\n};\n\ntype InferClientRoutes<T extends Record<string, Endpoint>> = {\n\t[K in keyof T]: T[K] extends Endpoint<any, infer O>\n\t\t? O extends\n\t\t\t\t| { metadata: { scope: \"http\" } }\n\t\t\t\t| { metadata: { scope: \"server\" } }\n\t\t\t\t| { metadata: { SERVER_ONLY: true } }\n\t\t\t\t| { metadata: { isAction: false } }\n\t\t\t? never\n\t\t\t: T[K]\n\t\t: T[K];\n};\n\nexport type RequiredOptionKeys<\n\tC extends {\n\t\tbody?: any;\n\t\tquery?: any;\n\t\tparams?: any;\n\t},\n> = (undefined extends C[\"body\"]\n\t? {}\n\t: {\n\t\t\tbody: true;\n\t\t}) &\n\t(undefined extends C[\"query\"]\n\t\t? {}\n\t\t: {\n\t\t\t\tquery: true;\n\t\t\t}) &\n\t(undefined extends C[\"params\"]\n\t\t? {}\n\t\t: {\n\t\t\t\tparams: true;\n\t\t\t});\n\nexport const createClient = <R extends Router | Router[\"endpoints\"]>(options: ClientOptions) => {\n\tconst fetch = createFetch(options);\n\ttype API = InferClientRoutes<\n\t\tR extends { endpoints: Record<string, Endpoint> } ? R[\"endpoints\"] : R\n\t>;\n\ttype Options = API extends {\n\t\t[key: string]: infer T;\n\t}\n\t\t? T extends Endpoint\n\t\t\t? {\n\t\t\t\t\t[key in T[\"options\"][\"method\"] extends \"GET\"\n\t\t\t\t\t\t? T[\"path\"]\n\t\t\t\t\t\t: `@${T[\"options\"][\"method\"] extends string ? Lowercase<T[\"options\"][\"method\"]> : never}${T[\"path\"]}`]: T;\n\t\t\t\t}\n\t\t\t: {}\n\t\t: {};\n\n\ttype O = Prettify<UnionToIntersection<Options>>;\n\treturn async <OPT extends O, K extends keyof OPT, C extends InferContext<OPT[K]>>(\n\t\tpath: K,\n\t\t...options: HasRequired<C> extends true\n\t\t\t? [\n\t\t\t\t\tWithRequired<\n\t\t\t\t\t\tBetterFetchOption<C[\"body\"], C[\"query\"], C[\"params\"]>,\n\t\t\t\t\t\tkeyof RequiredOptionKeys<C>\n\t\t\t\t\t>,\n\t\t\t\t]\n\t\t\t: [BetterFetchOption<C[\"body\"], C[\"query\"], C[\"params\"]>?]\n\t): Promise<\n\t\tBetterFetchResponse<Awaited<ReturnType<OPT[K] extends Endpoint ? OPT[K] : never>>>\n\t> => {\n\t\treturn (await fetch(path as string, {\n\t\t\t...options[0],\n\t\t})) as any;\n\t};\n};\n\nexport * from \"./error\";\n"],"mappings":";;;;;AAiFA,MAAa,gBAAwD,YAA2B;CAC/F,MAAM,8CAAoB,QAAQ;AAiBlC,QAAO,OACN,MACA,GAAGA,cAUC;AACJ,SAAQ,MAAM,MAAM,MAAgB,EACnC,GAAGA,UAAQ,IACX,CAAC"}
|
package/dist/client.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { et as UnionToIntersection, i as Endpoint, q as HasRequiredKeys, t as Router } from "./router.cjs";
|
|
2
|
+
import { a as hideInternalStackFrames, i as ValidationError, n as BetterCallError, o as makeErrorForHideStackFrame, r as Status, s as statusCodes, t as APIError } from "./error2.cjs";
|
|
2
3
|
import { BetterFetchOption, BetterFetchResponse } from "@better-fetch/fetch";
|
|
3
4
|
|
|
4
5
|
//#region src/client.d.ts
|
|
@@ -50,5 +51,5 @@ declare const createClient: <R extends Router | Router["endpoints"]>(options: Cl
|
|
|
50
51
|
[key: string]: infer T_1;
|
|
51
52
|
} ? T_1 extends Endpoint ? { [key in T_1["options"]["method"] extends "GET" ? T_1["path"] : `@${T_1["options"]["method"] extends string ? Lowercase<T_1["options"]["method"]> : never}${T_1["path"]}`]: T_1 } : {} : {}>[K_1] } : never), K extends keyof OPT, C extends InferContext<OPT[K]>>(path: K, ...options: HasRequired<C> extends true ? [WithRequired<BetterFetchOption<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>] : [BetterFetchOption<C["body"], C["query"], C["params"]>?]) => Promise<BetterFetchResponse<Awaited<ReturnType<OPT[K] extends Endpoint ? OPT[K] : never>>>>;
|
|
52
53
|
//#endregion
|
|
53
|
-
export { ClientOptions, RequiredOptionKeys, createClient };
|
|
54
|
+
export { APIError, BetterCallError, ClientOptions, RequiredOptionKeys, Status, ValidationError, createClient, hideInternalStackFrames, makeErrorForHideStackFrame, statusCodes };
|
|
54
55
|
//# sourceMappingURL=client.d.cts.map
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { et as UnionToIntersection, i as Endpoint, q as HasRequiredKeys, t as Router } from "./router.js";
|
|
2
|
+
import { a as hideInternalStackFrames, i as ValidationError, n as BetterCallError, o as makeErrorForHideStackFrame, r as Status, s as statusCodes, t as APIError } from "./error2.js";
|
|
2
3
|
import { BetterFetchOption, BetterFetchResponse } from "@better-fetch/fetch";
|
|
3
4
|
|
|
4
5
|
//#region src/client.d.ts
|
|
@@ -50,5 +51,5 @@ declare const createClient: <R extends Router | Router["endpoints"]>(options: Cl
|
|
|
50
51
|
[key: string]: infer T_1;
|
|
51
52
|
} ? T_1 extends Endpoint ? { [key in T_1["options"]["method"] extends "GET" ? T_1["path"] : `@${T_1["options"]["method"] extends string ? Lowercase<T_1["options"]["method"]> : never}${T_1["path"]}`]: T_1 } : {} : {}>[K_1] } : never), K extends keyof OPT, C extends InferContext<OPT[K]>>(path: K, ...options: HasRequired<C> extends true ? [WithRequired<BetterFetchOption<C["body"], C["query"], C["params"]>, keyof RequiredOptionKeys<C>>] : [BetterFetchOption<C["body"], C["query"], C["params"]>?]) => Promise<BetterFetchResponse<Awaited<ReturnType<OPT[K] extends Endpoint ? OPT[K] : never>>>>;
|
|
52
53
|
//#endregion
|
|
53
|
-
export { ClientOptions, RequiredOptionKeys, createClient };
|
|
54
|
+
export { APIError, BetterCallError, ClientOptions, RequiredOptionKeys, Status, ValidationError, createClient, hideInternalStackFrames, makeErrorForHideStackFrame, statusCodes };
|
|
54
55
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { a as makeErrorForHideStackFrame, i as hideInternalStackFrames, n as BetterCallError, o as statusCodes, r as ValidationError, t as APIError } from "./error2.js";
|
|
1
2
|
import { createFetch } from "@better-fetch/fetch";
|
|
2
3
|
|
|
3
4
|
//#region src/client.ts
|
|
@@ -9,5 +10,5 @@ const createClient = (options) => {
|
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
//#endregion
|
|
12
|
-
export { createClient };
|
|
13
|
+
export { APIError, BetterCallError, ValidationError, createClient, hideInternalStackFrames, makeErrorForHideStackFrame, statusCodes };
|
|
13
14
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["options"],"sources":["../src/client.ts"],"sourcesContent":["import { type BetterFetchOption, type BetterFetchResponse, createFetch } from \"@better-fetch/fetch\";\nimport type { Router } from \"./router\";\nimport type { HasRequiredKeys, Prettify, UnionToIntersection } from \"./helper\";\nimport type { Endpoint } from \"./endpoint\";\n\ntype HasRequired<\n\tT extends {\n\t\tbody?: any;\n\t\tquery?: any;\n\t\tparams?: any;\n\t},\n> = T[\"body\"] extends object\n\t? HasRequiredKeys<T[\"body\"]> extends true\n\t\t? true\n\t\t: T[\"query\"] extends object\n\t\t\t? HasRequiredKeys<T[\"query\"]> extends true\n\t\t\t\t? true\n\t\t\t\t: T[\"params\"] extends object\n\t\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t\t: false\n\t\t\t: T[\"params\"] extends object\n\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t: false\n\t: T[\"query\"] extends object\n\t\t? HasRequiredKeys<T[\"query\"]> extends true\n\t\t\t? true\n\t\t\t: T[\"params\"] extends object\n\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t: false\n\t\t: T[\"params\"] extends object\n\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t: false;\n\ntype InferContext<T> = T extends (ctx: infer Ctx) => any\n\t? Ctx extends object\n\t\t? Ctx\n\t\t: never\n\t: never;\n\nexport interface ClientOptions extends BetterFetchOption {\n\tbaseURL: string;\n}\n\ntype WithRequired<T, K> = T & {\n\t[P in K extends string ? K : never]-?: T[P extends keyof T ? P : never];\n};\n\ntype InferClientRoutes<T extends Record<string, Endpoint>> = {\n\t[K in keyof T]: T[K] extends Endpoint<any, infer O>\n\t\t? O extends\n\t\t\t\t| { metadata: { scope: \"http\" } }\n\t\t\t\t| { metadata: { scope: \"server\" } }\n\t\t\t\t| { metadata: { SERVER_ONLY: true } }\n\t\t\t\t| { metadata: { isAction: false } }\n\t\t\t? never\n\t\t\t: T[K]\n\t\t: T[K];\n};\n\nexport type RequiredOptionKeys<\n\tC extends {\n\t\tbody?: any;\n\t\tquery?: any;\n\t\tparams?: any;\n\t},\n> = (undefined extends C[\"body\"]\n\t? {}\n\t: {\n\t\t\tbody: true;\n\t\t}) &\n\t(undefined extends C[\"query\"]\n\t\t? {}\n\t\t: {\n\t\t\t\tquery: true;\n\t\t\t}) &\n\t(undefined extends C[\"params\"]\n\t\t? {}\n\t\t: {\n\t\t\t\tparams: true;\n\t\t\t});\n\nexport const createClient = <R extends Router | Router[\"endpoints\"]>(options: ClientOptions) => {\n\tconst fetch = createFetch(options);\n\ttype API = InferClientRoutes<\n\t\tR extends { endpoints: Record<string, Endpoint> } ? R[\"endpoints\"] : R\n\t>;\n\ttype Options = API extends {\n\t\t[key: string]: infer T;\n\t}\n\t\t? T extends Endpoint\n\t\t\t? {\n\t\t\t\t\t[key in T[\"options\"][\"method\"] extends \"GET\"\n\t\t\t\t\t\t? T[\"path\"]\n\t\t\t\t\t\t: `@${T[\"options\"][\"method\"] extends string ? Lowercase<T[\"options\"][\"method\"]> : never}${T[\"path\"]}`]: T;\n\t\t\t\t}\n\t\t\t: {}\n\t\t: {};\n\n\ttype O = Prettify<UnionToIntersection<Options>>;\n\treturn async <OPT extends O, K extends keyof OPT, C extends InferContext<OPT[K]>>(\n\t\tpath: K,\n\t\t...options: HasRequired<C> extends true\n\t\t\t? [\n\t\t\t\t\tWithRequired<\n\t\t\t\t\t\tBetterFetchOption<C[\"body\"], C[\"query\"], C[\"params\"]>,\n\t\t\t\t\t\tkeyof RequiredOptionKeys<C>\n\t\t\t\t\t>,\n\t\t\t\t]\n\t\t\t: [BetterFetchOption<C[\"body\"], C[\"query\"], C[\"params\"]>?]\n\t): Promise<\n\t\tBetterFetchResponse<Awaited<ReturnType<OPT[K] extends Endpoint ? OPT[K] : never>>>\n\t> => {\n\t\treturn (await fetch(path as string, {\n\t\t\t...options[0],\n\t\t})) as any;\n\t};\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","names":["options"],"sources":["../src/client.ts"],"sourcesContent":["import { type BetterFetchOption, type BetterFetchResponse, createFetch } from \"@better-fetch/fetch\";\nimport type { Router } from \"./router\";\nimport type { HasRequiredKeys, Prettify, UnionToIntersection } from \"./helper\";\nimport type { Endpoint } from \"./endpoint\";\n\ntype HasRequired<\n\tT extends {\n\t\tbody?: any;\n\t\tquery?: any;\n\t\tparams?: any;\n\t},\n> = T[\"body\"] extends object\n\t? HasRequiredKeys<T[\"body\"]> extends true\n\t\t? true\n\t\t: T[\"query\"] extends object\n\t\t\t? HasRequiredKeys<T[\"query\"]> extends true\n\t\t\t\t? true\n\t\t\t\t: T[\"params\"] extends object\n\t\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t\t: false\n\t\t\t: T[\"params\"] extends object\n\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t: false\n\t: T[\"query\"] extends object\n\t\t? HasRequiredKeys<T[\"query\"]> extends true\n\t\t\t? true\n\t\t\t: T[\"params\"] extends object\n\t\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t\t: false\n\t\t: T[\"params\"] extends object\n\t\t\t? HasRequiredKeys<T[\"params\"]>\n\t\t\t: false;\n\ntype InferContext<T> = T extends (ctx: infer Ctx) => any\n\t? Ctx extends object\n\t\t? Ctx\n\t\t: never\n\t: never;\n\nexport interface ClientOptions extends BetterFetchOption {\n\tbaseURL: string;\n}\n\ntype WithRequired<T, K> = T & {\n\t[P in K extends string ? K : never]-?: T[P extends keyof T ? P : never];\n};\n\ntype InferClientRoutes<T extends Record<string, Endpoint>> = {\n\t[K in keyof T]: T[K] extends Endpoint<any, infer O>\n\t\t? O extends\n\t\t\t\t| { metadata: { scope: \"http\" } }\n\t\t\t\t| { metadata: { scope: \"server\" } }\n\t\t\t\t| { metadata: { SERVER_ONLY: true } }\n\t\t\t\t| { metadata: { isAction: false } }\n\t\t\t? never\n\t\t\t: T[K]\n\t\t: T[K];\n};\n\nexport type RequiredOptionKeys<\n\tC extends {\n\t\tbody?: any;\n\t\tquery?: any;\n\t\tparams?: any;\n\t},\n> = (undefined extends C[\"body\"]\n\t? {}\n\t: {\n\t\t\tbody: true;\n\t\t}) &\n\t(undefined extends C[\"query\"]\n\t\t? {}\n\t\t: {\n\t\t\t\tquery: true;\n\t\t\t}) &\n\t(undefined extends C[\"params\"]\n\t\t? {}\n\t\t: {\n\t\t\t\tparams: true;\n\t\t\t});\n\nexport const createClient = <R extends Router | Router[\"endpoints\"]>(options: ClientOptions) => {\n\tconst fetch = createFetch(options);\n\ttype API = InferClientRoutes<\n\t\tR extends { endpoints: Record<string, Endpoint> } ? R[\"endpoints\"] : R\n\t>;\n\ttype Options = API extends {\n\t\t[key: string]: infer T;\n\t}\n\t\t? T extends Endpoint\n\t\t\t? {\n\t\t\t\t\t[key in T[\"options\"][\"method\"] extends \"GET\"\n\t\t\t\t\t\t? T[\"path\"]\n\t\t\t\t\t\t: `@${T[\"options\"][\"method\"] extends string ? Lowercase<T[\"options\"][\"method\"]> : never}${T[\"path\"]}`]: T;\n\t\t\t\t}\n\t\t\t: {}\n\t\t: {};\n\n\ttype O = Prettify<UnionToIntersection<Options>>;\n\treturn async <OPT extends O, K extends keyof OPT, C extends InferContext<OPT[K]>>(\n\t\tpath: K,\n\t\t...options: HasRequired<C> extends true\n\t\t\t? [\n\t\t\t\t\tWithRequired<\n\t\t\t\t\t\tBetterFetchOption<C[\"body\"], C[\"query\"], C[\"params\"]>,\n\t\t\t\t\t\tkeyof RequiredOptionKeys<C>\n\t\t\t\t\t>,\n\t\t\t\t]\n\t\t\t: [BetterFetchOption<C[\"body\"], C[\"query\"], C[\"params\"]>?]\n\t): Promise<\n\t\tBetterFetchResponse<Awaited<ReturnType<OPT[K] extends Endpoint ? OPT[K] : never>>>\n\t> => {\n\t\treturn (await fetch(path as string, {\n\t\t\t...options[0],\n\t\t})) as any;\n\t};\n};\n\nexport * from \"./error\";\n"],"mappings":";;;;AAiFA,MAAa,gBAAwD,YAA2B;CAC/F,MAAM,QAAQ,YAAY,QAAQ;AAiBlC,QAAO,OACN,MACA,GAAGA,cAUC;AACJ,SAAQ,MAAM,MAAM,MAAgB,EACnC,GAAGA,UAAQ,IACX,CAAC"}
|
package/dist/error.cjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const require_error = require('./error2.cjs');
|
|
2
|
+
|
|
3
|
+
exports.APIError = require_error.APIError;
|
|
4
|
+
exports.BetterCallError = require_error.BetterCallError;
|
|
5
|
+
exports.ValidationError = require_error.ValidationError;
|
|
6
|
+
exports.hideInternalStackFrames = require_error.hideInternalStackFrames;
|
|
7
|
+
exports.makeErrorForHideStackFrame = require_error.makeErrorForHideStackFrame;
|
|
8
|
+
exports.statusCodes = require_error.statusCodes;
|
package/dist/error.d.cts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as hideInternalStackFrames, i as ValidationError, n as BetterCallError, o as makeErrorForHideStackFrame, r as Status, s as statusCodes, t as APIError } from "./error2.cjs";
|
|
2
|
+
export { APIError, BetterCallError, Status, ValidationError, hideInternalStackFrames, makeErrorForHideStackFrame, statusCodes };
|
package/dist/error.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as hideInternalStackFrames, i as ValidationError, n as BetterCallError, o as makeErrorForHideStackFrame, r as Status, s as statusCodes, t as APIError } from "./error2.js";
|
|
2
|
+
export { APIError, BetterCallError, Status, ValidationError, hideInternalStackFrames, makeErrorForHideStackFrame, statusCodes };
|
package/dist/error.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as makeErrorForHideStackFrame, i as hideInternalStackFrames, n as BetterCallError, o as statusCodes, r as ValidationError, t as APIError } from "./error2.js";
|
|
2
|
+
|
|
3
|
+
export { APIError, BetterCallError, ValidationError, hideInternalStackFrames, makeErrorForHideStackFrame, statusCodes };
|