better-call 1.1.5 → 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/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 +17 -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 +1 -133
- package/dist/index.js.map +1 -1
- package/dist/router.d.cts +3 -156
- package/dist/router.d.ts +3 -156
- package/package.json +11 -1
package/dist/router.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { c as StandardSchemaV1, r as Status, s as statusCodes, t as APIError } from "./error2.cjs";
|
|
2
|
+
|
|
1
3
|
//#region src/helper.d.ts
|
|
2
4
|
type RequiredKeysOf<BaseType extends object> = Exclude<{ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never }[keyof BaseType], undefined>;
|
|
3
5
|
type HasRequiredKeys<BaseType extends object> = RequiredKeysOf<BaseType> extends never ? false : true;
|
|
@@ -8,161 +10,6 @@ type MergeObject<T extends Record<string, any> | never, S extends Record<string,
|
|
|
8
10
|
type InferParamPath<Path> = Path extends `${infer _Start}:${infer Param}/${infer Rest}` ? { [K in Param | keyof InferParamPath<Rest>]: string } : Path extends `${infer _Start}:${infer Param}` ? { [K in Param]: string } : Path extends `${infer _Start}/${infer Rest}` ? InferParamPath<Rest> : {};
|
|
9
11
|
type InferParamWildCard<Path> = Path extends `${infer _Start}/*:${infer Param}/${infer Rest}` | `${infer _Start}/**:${infer Param}/${infer Rest}` ? { [K in Param | keyof InferParamPath<Rest>]: string } : Path extends `${infer _Start}/*` ? { [K in "_"]: string } : Path extends `${infer _Start}/${infer Rest}` ? InferParamWildCard<Rest> : {};
|
|
10
12
|
//#endregion
|
|
11
|
-
//#region src/standard-schema.d.ts
|
|
12
|
-
/** The Standard Schema interface. */
|
|
13
|
-
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
14
|
-
/** The Standard Schema properties. */
|
|
15
|
-
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
16
|
-
}
|
|
17
|
-
declare namespace StandardSchemaV1 {
|
|
18
|
-
/** The Standard Schema properties interface. */
|
|
19
|
-
interface Props<Input = unknown, Output = Input> {
|
|
20
|
-
/** The version number of the standard. */
|
|
21
|
-
readonly version: 1;
|
|
22
|
-
/** The vendor name of the schema library. */
|
|
23
|
-
readonly vendor: string;
|
|
24
|
-
/** Validates unknown input values. */
|
|
25
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
26
|
-
/** Inferred types associated with the schema. */
|
|
27
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
28
|
-
}
|
|
29
|
-
/** The result interface of the validate function. */
|
|
30
|
-
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
31
|
-
/** The result interface if validation succeeds. */
|
|
32
|
-
interface SuccessResult<Output> {
|
|
33
|
-
/** The typed output value. */
|
|
34
|
-
readonly value: Output;
|
|
35
|
-
/** The non-existent issues. */
|
|
36
|
-
readonly issues?: undefined;
|
|
37
|
-
}
|
|
38
|
-
/** The result interface if validation fails. */
|
|
39
|
-
interface FailureResult {
|
|
40
|
-
/** The issues of failed validation. */
|
|
41
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
42
|
-
}
|
|
43
|
-
/** The issue interface of the failure output. */
|
|
44
|
-
interface Issue {
|
|
45
|
-
/** The error message of the issue. */
|
|
46
|
-
readonly message: string;
|
|
47
|
-
/** The path of the issue, if any. */
|
|
48
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
49
|
-
}
|
|
50
|
-
/** The path segment interface of the issue. */
|
|
51
|
-
interface PathSegment {
|
|
52
|
-
/** The key representing a path segment. */
|
|
53
|
-
readonly key: PropertyKey;
|
|
54
|
-
}
|
|
55
|
-
/** The Standard Schema types interface. */
|
|
56
|
-
interface Types<Input = unknown, Output = Input> {
|
|
57
|
-
/** The input type of the schema. */
|
|
58
|
-
readonly input: Input;
|
|
59
|
-
/** The output type of the schema. */
|
|
60
|
-
readonly output: Output;
|
|
61
|
-
}
|
|
62
|
-
/** Infers the input type of a Standard Schema. */
|
|
63
|
-
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
64
|
-
/** Infers the output type of a Standard Schema. */
|
|
65
|
-
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
66
|
-
}
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region src/error.d.ts
|
|
69
|
-
/**
|
|
70
|
-
* Hide internal stack frames from the error stack trace.
|
|
71
|
-
*/
|
|
72
|
-
declare function hideInternalStackFrames(stack: string): string;
|
|
73
|
-
/**
|
|
74
|
-
* Creates a custom error class that hides stack frames.
|
|
75
|
-
*/
|
|
76
|
-
declare function makeErrorForHideStackFrame<B extends new (...args: any[]) => Error>(Base: B, clazz: any): {
|
|
77
|
-
new (...args: ConstructorParameters<B>): InstanceType<B> & {
|
|
78
|
-
errorStack: string | undefined;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
declare const statusCodes: {
|
|
82
|
-
OK: number;
|
|
83
|
-
CREATED: number;
|
|
84
|
-
ACCEPTED: number;
|
|
85
|
-
NO_CONTENT: number;
|
|
86
|
-
MULTIPLE_CHOICES: number;
|
|
87
|
-
MOVED_PERMANENTLY: number;
|
|
88
|
-
FOUND: number;
|
|
89
|
-
SEE_OTHER: number;
|
|
90
|
-
NOT_MODIFIED: number;
|
|
91
|
-
TEMPORARY_REDIRECT: number;
|
|
92
|
-
BAD_REQUEST: number;
|
|
93
|
-
UNAUTHORIZED: number;
|
|
94
|
-
PAYMENT_REQUIRED: number;
|
|
95
|
-
FORBIDDEN: number;
|
|
96
|
-
NOT_FOUND: number;
|
|
97
|
-
METHOD_NOT_ALLOWED: number;
|
|
98
|
-
NOT_ACCEPTABLE: number;
|
|
99
|
-
PROXY_AUTHENTICATION_REQUIRED: number;
|
|
100
|
-
REQUEST_TIMEOUT: number;
|
|
101
|
-
CONFLICT: number;
|
|
102
|
-
GONE: number;
|
|
103
|
-
LENGTH_REQUIRED: number;
|
|
104
|
-
PRECONDITION_FAILED: number;
|
|
105
|
-
PAYLOAD_TOO_LARGE: number;
|
|
106
|
-
URI_TOO_LONG: number;
|
|
107
|
-
UNSUPPORTED_MEDIA_TYPE: number;
|
|
108
|
-
RANGE_NOT_SATISFIABLE: number;
|
|
109
|
-
EXPECTATION_FAILED: number;
|
|
110
|
-
"I'M_A_TEAPOT": number;
|
|
111
|
-
MISDIRECTED_REQUEST: number;
|
|
112
|
-
UNPROCESSABLE_ENTITY: number;
|
|
113
|
-
LOCKED: number;
|
|
114
|
-
FAILED_DEPENDENCY: number;
|
|
115
|
-
TOO_EARLY: number;
|
|
116
|
-
UPGRADE_REQUIRED: number;
|
|
117
|
-
PRECONDITION_REQUIRED: number;
|
|
118
|
-
TOO_MANY_REQUESTS: number;
|
|
119
|
-
REQUEST_HEADER_FIELDS_TOO_LARGE: number;
|
|
120
|
-
UNAVAILABLE_FOR_LEGAL_REASONS: number;
|
|
121
|
-
INTERNAL_SERVER_ERROR: number;
|
|
122
|
-
NOT_IMPLEMENTED: number;
|
|
123
|
-
BAD_GATEWAY: number;
|
|
124
|
-
SERVICE_UNAVAILABLE: number;
|
|
125
|
-
GATEWAY_TIMEOUT: number;
|
|
126
|
-
HTTP_VERSION_NOT_SUPPORTED: number;
|
|
127
|
-
VARIANT_ALSO_NEGOTIATES: number;
|
|
128
|
-
INSUFFICIENT_STORAGE: number;
|
|
129
|
-
LOOP_DETECTED: number;
|
|
130
|
-
NOT_EXTENDED: number;
|
|
131
|
-
NETWORK_AUTHENTICATION_REQUIRED: number;
|
|
132
|
-
};
|
|
133
|
-
type Status = 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
134
|
-
declare class InternalAPIError extends Error {
|
|
135
|
-
status: keyof typeof statusCodes | Status;
|
|
136
|
-
body: ({
|
|
137
|
-
message?: string;
|
|
138
|
-
code?: string;
|
|
139
|
-
cause?: unknown;
|
|
140
|
-
} & Record<string, any>) | undefined;
|
|
141
|
-
headers: HeadersInit;
|
|
142
|
-
statusCode: number;
|
|
143
|
-
constructor(status?: keyof typeof statusCodes | Status, body?: ({
|
|
144
|
-
message?: string;
|
|
145
|
-
code?: string;
|
|
146
|
-
cause?: unknown;
|
|
147
|
-
} & Record<string, any>) | undefined, headers?: HeadersInit, statusCode?: number);
|
|
148
|
-
}
|
|
149
|
-
declare class ValidationError extends InternalAPIError {
|
|
150
|
-
message: string;
|
|
151
|
-
issues: readonly StandardSchemaV1.Issue[];
|
|
152
|
-
constructor(message: string, issues: readonly StandardSchemaV1.Issue[]);
|
|
153
|
-
}
|
|
154
|
-
declare class BetterCallError extends Error {
|
|
155
|
-
constructor(message: string);
|
|
156
|
-
}
|
|
157
|
-
type APIError = InstanceType<typeof InternalAPIError>;
|
|
158
|
-
declare const APIError: new (status?: "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED" | Status | undefined, body?: ({
|
|
159
|
-
message?: string;
|
|
160
|
-
code?: string;
|
|
161
|
-
cause?: unknown;
|
|
162
|
-
} & Record<string, any>) | undefined, headers?: HeadersInit | undefined, statusCode?: number | undefined) => InternalAPIError & {
|
|
163
|
-
errorStack: string | undefined;
|
|
164
|
-
};
|
|
165
|
-
//#endregion
|
|
166
13
|
//#region src/cookies.d.ts
|
|
167
14
|
type CookiePrefixOptions = "host" | "secure";
|
|
168
15
|
type CookieOptions = {
|
|
@@ -1331,5 +1178,5 @@ declare const createRouter: <E extends Record<string, Endpoint>, Config extends
|
|
|
1331
1178
|
};
|
|
1332
1179
|
type Router = ReturnType<typeof createRouter>;
|
|
1333
1180
|
//#endregion
|
|
1334
|
-
export {
|
|
1181
|
+
export { RequiredKeysOf as $, InferMiddlewareQuery as A, createInternalContext as B, InferBody as C, InferInputMethod as D, InferHeadersInput as E, InferRequest as F, serializeCookie as G, CookiePrefixOptions as H, InferRequestInput as I, InferParamPath as J, serializeSignedCookie as K, InferUse as L, InferParamInput as M, InferQuery as N, InferMethod as O, InferQueryInput as P, Prettify as Q, InputContext as R, HTTPMethod as S, InferHeaders as T, getCookieKey as U, CookieOptions as V, parseCookies as W, IsEmptyObject as X, InferParamWildCard as Y, MergeObject as Z, MiddlewareContext as _, EndpointBaseOptions as a, MiddlewareResponse as b, EndpointOptions as c, OpenAPIParameter as d, UnionToIntersection as et, OpenAPISchemaType as f, Middleware as g, getHTML as h, Endpoint as i, InferParam as j, InferMiddlewareBody as k, StrictEndpoint as l, generator as m, RouterConfig as n, EndpointBodyMethodOptions as o, Path$1 as p, HasRequiredKeys as q, createRouter as r, EndpointContext as s, Router as t, createEndpoint as u, MiddlewareInputContext as v, InferBodyInput as w, createMiddleware as x, MiddlewareOptions as y, Method as z };
|
|
1335
1182
|
//# sourceMappingURL=router.d.cts.map
|
package/dist/router.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { c as StandardSchemaV1, r as Status, s as statusCodes, t as APIError } from "./error2.js";
|
|
2
|
+
|
|
1
3
|
//#region src/helper.d.ts
|
|
2
4
|
type RequiredKeysOf<BaseType extends object> = Exclude<{ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never }[keyof BaseType], undefined>;
|
|
3
5
|
type HasRequiredKeys<BaseType extends object> = RequiredKeysOf<BaseType> extends never ? false : true;
|
|
@@ -8,161 +10,6 @@ type MergeObject<T extends Record<string, any> | never, S extends Record<string,
|
|
|
8
10
|
type InferParamPath<Path> = Path extends `${infer _Start}:${infer Param}/${infer Rest}` ? { [K in Param | keyof InferParamPath<Rest>]: string } : Path extends `${infer _Start}:${infer Param}` ? { [K in Param]: string } : Path extends `${infer _Start}/${infer Rest}` ? InferParamPath<Rest> : {};
|
|
9
11
|
type InferParamWildCard<Path> = Path extends `${infer _Start}/*:${infer Param}/${infer Rest}` | `${infer _Start}/**:${infer Param}/${infer Rest}` ? { [K in Param | keyof InferParamPath<Rest>]: string } : Path extends `${infer _Start}/*` ? { [K in "_"]: string } : Path extends `${infer _Start}/${infer Rest}` ? InferParamWildCard<Rest> : {};
|
|
10
12
|
//#endregion
|
|
11
|
-
//#region src/standard-schema.d.ts
|
|
12
|
-
/** The Standard Schema interface. */
|
|
13
|
-
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
14
|
-
/** The Standard Schema properties. */
|
|
15
|
-
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
16
|
-
}
|
|
17
|
-
declare namespace StandardSchemaV1 {
|
|
18
|
-
/** The Standard Schema properties interface. */
|
|
19
|
-
interface Props<Input = unknown, Output = Input> {
|
|
20
|
-
/** The version number of the standard. */
|
|
21
|
-
readonly version: 1;
|
|
22
|
-
/** The vendor name of the schema library. */
|
|
23
|
-
readonly vendor: string;
|
|
24
|
-
/** Validates unknown input values. */
|
|
25
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
26
|
-
/** Inferred types associated with the schema. */
|
|
27
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
28
|
-
}
|
|
29
|
-
/** The result interface of the validate function. */
|
|
30
|
-
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
31
|
-
/** The result interface if validation succeeds. */
|
|
32
|
-
interface SuccessResult<Output> {
|
|
33
|
-
/** The typed output value. */
|
|
34
|
-
readonly value: Output;
|
|
35
|
-
/** The non-existent issues. */
|
|
36
|
-
readonly issues?: undefined;
|
|
37
|
-
}
|
|
38
|
-
/** The result interface if validation fails. */
|
|
39
|
-
interface FailureResult {
|
|
40
|
-
/** The issues of failed validation. */
|
|
41
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
42
|
-
}
|
|
43
|
-
/** The issue interface of the failure output. */
|
|
44
|
-
interface Issue {
|
|
45
|
-
/** The error message of the issue. */
|
|
46
|
-
readonly message: string;
|
|
47
|
-
/** The path of the issue, if any. */
|
|
48
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
49
|
-
}
|
|
50
|
-
/** The path segment interface of the issue. */
|
|
51
|
-
interface PathSegment {
|
|
52
|
-
/** The key representing a path segment. */
|
|
53
|
-
readonly key: PropertyKey;
|
|
54
|
-
}
|
|
55
|
-
/** The Standard Schema types interface. */
|
|
56
|
-
interface Types<Input = unknown, Output = Input> {
|
|
57
|
-
/** The input type of the schema. */
|
|
58
|
-
readonly input: Input;
|
|
59
|
-
/** The output type of the schema. */
|
|
60
|
-
readonly output: Output;
|
|
61
|
-
}
|
|
62
|
-
/** Infers the input type of a Standard Schema. */
|
|
63
|
-
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
64
|
-
/** Infers the output type of a Standard Schema. */
|
|
65
|
-
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
66
|
-
}
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region src/error.d.ts
|
|
69
|
-
/**
|
|
70
|
-
* Hide internal stack frames from the error stack trace.
|
|
71
|
-
*/
|
|
72
|
-
declare function hideInternalStackFrames(stack: string): string;
|
|
73
|
-
/**
|
|
74
|
-
* Creates a custom error class that hides stack frames.
|
|
75
|
-
*/
|
|
76
|
-
declare function makeErrorForHideStackFrame<B extends new (...args: any[]) => Error>(Base: B, clazz: any): {
|
|
77
|
-
new (...args: ConstructorParameters<B>): InstanceType<B> & {
|
|
78
|
-
errorStack: string | undefined;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
declare const statusCodes: {
|
|
82
|
-
OK: number;
|
|
83
|
-
CREATED: number;
|
|
84
|
-
ACCEPTED: number;
|
|
85
|
-
NO_CONTENT: number;
|
|
86
|
-
MULTIPLE_CHOICES: number;
|
|
87
|
-
MOVED_PERMANENTLY: number;
|
|
88
|
-
FOUND: number;
|
|
89
|
-
SEE_OTHER: number;
|
|
90
|
-
NOT_MODIFIED: number;
|
|
91
|
-
TEMPORARY_REDIRECT: number;
|
|
92
|
-
BAD_REQUEST: number;
|
|
93
|
-
UNAUTHORIZED: number;
|
|
94
|
-
PAYMENT_REQUIRED: number;
|
|
95
|
-
FORBIDDEN: number;
|
|
96
|
-
NOT_FOUND: number;
|
|
97
|
-
METHOD_NOT_ALLOWED: number;
|
|
98
|
-
NOT_ACCEPTABLE: number;
|
|
99
|
-
PROXY_AUTHENTICATION_REQUIRED: number;
|
|
100
|
-
REQUEST_TIMEOUT: number;
|
|
101
|
-
CONFLICT: number;
|
|
102
|
-
GONE: number;
|
|
103
|
-
LENGTH_REQUIRED: number;
|
|
104
|
-
PRECONDITION_FAILED: number;
|
|
105
|
-
PAYLOAD_TOO_LARGE: number;
|
|
106
|
-
URI_TOO_LONG: number;
|
|
107
|
-
UNSUPPORTED_MEDIA_TYPE: number;
|
|
108
|
-
RANGE_NOT_SATISFIABLE: number;
|
|
109
|
-
EXPECTATION_FAILED: number;
|
|
110
|
-
"I'M_A_TEAPOT": number;
|
|
111
|
-
MISDIRECTED_REQUEST: number;
|
|
112
|
-
UNPROCESSABLE_ENTITY: number;
|
|
113
|
-
LOCKED: number;
|
|
114
|
-
FAILED_DEPENDENCY: number;
|
|
115
|
-
TOO_EARLY: number;
|
|
116
|
-
UPGRADE_REQUIRED: number;
|
|
117
|
-
PRECONDITION_REQUIRED: number;
|
|
118
|
-
TOO_MANY_REQUESTS: number;
|
|
119
|
-
REQUEST_HEADER_FIELDS_TOO_LARGE: number;
|
|
120
|
-
UNAVAILABLE_FOR_LEGAL_REASONS: number;
|
|
121
|
-
INTERNAL_SERVER_ERROR: number;
|
|
122
|
-
NOT_IMPLEMENTED: number;
|
|
123
|
-
BAD_GATEWAY: number;
|
|
124
|
-
SERVICE_UNAVAILABLE: number;
|
|
125
|
-
GATEWAY_TIMEOUT: number;
|
|
126
|
-
HTTP_VERSION_NOT_SUPPORTED: number;
|
|
127
|
-
VARIANT_ALSO_NEGOTIATES: number;
|
|
128
|
-
INSUFFICIENT_STORAGE: number;
|
|
129
|
-
LOOP_DETECTED: number;
|
|
130
|
-
NOT_EXTENDED: number;
|
|
131
|
-
NETWORK_AUTHENTICATION_REQUIRED: number;
|
|
132
|
-
};
|
|
133
|
-
type Status = 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
134
|
-
declare class InternalAPIError extends Error {
|
|
135
|
-
status: keyof typeof statusCodes | Status;
|
|
136
|
-
body: ({
|
|
137
|
-
message?: string;
|
|
138
|
-
code?: string;
|
|
139
|
-
cause?: unknown;
|
|
140
|
-
} & Record<string, any>) | undefined;
|
|
141
|
-
headers: HeadersInit;
|
|
142
|
-
statusCode: number;
|
|
143
|
-
constructor(status?: keyof typeof statusCodes | Status, body?: ({
|
|
144
|
-
message?: string;
|
|
145
|
-
code?: string;
|
|
146
|
-
cause?: unknown;
|
|
147
|
-
} & Record<string, any>) | undefined, headers?: HeadersInit, statusCode?: number);
|
|
148
|
-
}
|
|
149
|
-
declare class ValidationError extends InternalAPIError {
|
|
150
|
-
message: string;
|
|
151
|
-
issues: readonly StandardSchemaV1.Issue[];
|
|
152
|
-
constructor(message: string, issues: readonly StandardSchemaV1.Issue[]);
|
|
153
|
-
}
|
|
154
|
-
declare class BetterCallError extends Error {
|
|
155
|
-
constructor(message: string);
|
|
156
|
-
}
|
|
157
|
-
type APIError = InstanceType<typeof InternalAPIError>;
|
|
158
|
-
declare const APIError: new (status?: "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED" | Status | undefined, body?: ({
|
|
159
|
-
message?: string;
|
|
160
|
-
code?: string;
|
|
161
|
-
cause?: unknown;
|
|
162
|
-
} & Record<string, any>) | undefined, headers?: HeadersInit | undefined, statusCode?: number | undefined) => InternalAPIError & {
|
|
163
|
-
errorStack: string | undefined;
|
|
164
|
-
};
|
|
165
|
-
//#endregion
|
|
166
13
|
//#region src/cookies.d.ts
|
|
167
14
|
type CookiePrefixOptions = "host" | "secure";
|
|
168
15
|
type CookieOptions = {
|
|
@@ -1331,5 +1178,5 @@ declare const createRouter: <E extends Record<string, Endpoint>, Config extends
|
|
|
1331
1178
|
};
|
|
1332
1179
|
type Router = ReturnType<typeof createRouter>;
|
|
1333
1180
|
//#endregion
|
|
1334
|
-
export {
|
|
1181
|
+
export { RequiredKeysOf as $, InferMiddlewareQuery as A, createInternalContext as B, InferBody as C, InferInputMethod as D, InferHeadersInput as E, InferRequest as F, serializeCookie as G, CookiePrefixOptions as H, InferRequestInput as I, InferParamPath as J, serializeSignedCookie as K, InferUse as L, InferParamInput as M, InferQuery as N, InferMethod as O, InferQueryInput as P, Prettify as Q, InputContext as R, HTTPMethod as S, InferHeaders as T, getCookieKey as U, CookieOptions as V, parseCookies as W, IsEmptyObject as X, InferParamWildCard as Y, MergeObject as Z, MiddlewareContext as _, EndpointBaseOptions as a, MiddlewareResponse as b, EndpointOptions as c, OpenAPIParameter as d, UnionToIntersection as et, OpenAPISchemaType as f, Middleware as g, getHTML as h, Endpoint as i, InferParam as j, InferMiddlewareBody as k, StrictEndpoint as l, generator as m, RouterConfig as n, EndpointBodyMethodOptions as o, Path$1 as p, HasRequiredKeys as q, createRouter as r, EndpointContext as s, Router as t, createEndpoint as u, MiddlewareInputContext as v, InferBodyInput as w, createMiddleware as x, MiddlewareOptions as y, Method as z };
|
|
1335
1182
|
//# sourceMappingURL=router.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-call",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -67,6 +67,16 @@
|
|
|
67
67
|
"default": "./dist/client.cjs"
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
+
"./error": {
|
|
71
|
+
"import": {
|
|
72
|
+
"types": "./dist/error.d.ts",
|
|
73
|
+
"default": "./dist/error.js"
|
|
74
|
+
},
|
|
75
|
+
"require": {
|
|
76
|
+
"types": "./dist/error.d.cts",
|
|
77
|
+
"default": "./dist/error.cjs"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
70
80
|
"./node": {
|
|
71
81
|
"import": {
|
|
72
82
|
"types": "./dist/node.d.ts",
|