better-call 1.0.0-beta.3 → 1.0.0-beta.4
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 +2 -4
- package/dist/client.d.cts +1 -2
- package/dist/client.d.ts +1 -2
- package/dist/index.cjs +3896 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +3892 -3
- package/dist/index.js.map +1 -1
- package/dist/node.d.cts +1 -2
- package/dist/node.d.ts +1 -2
- package/dist/{router-DNpkEV0c.d.cts → router-CyNMWgsC.d.cts} +57 -3
- package/dist/{router-DNpkEV0c.d.ts → router-CyNMWgsC.d.ts} +57 -3
- package/package.json +5 -6
package/dist/node.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import { j as Router } from './router-
|
|
3
|
-
import '@standard-schema/spec';
|
|
2
|
+
import { j as Router } from './router-CyNMWgsC.cjs';
|
|
4
3
|
|
|
5
4
|
declare function getRequest({ request, base, bodySizeLimit, }: {
|
|
6
5
|
base: string;
|
package/dist/node.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import { j as Router } from './router-
|
|
3
|
-
import '@standard-schema/spec';
|
|
2
|
+
import { j as Router } from './router-CyNMWgsC.js';
|
|
4
3
|
|
|
5
4
|
declare function getRequest({ request, base, bodySizeLimit, }: {
|
|
6
5
|
base: string;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
-
|
|
3
1
|
declare const _statusCode: {
|
|
4
2
|
OK: number;
|
|
5
3
|
CREATED: number;
|
|
@@ -329,6 +327,62 @@ declare function parseCookies(cookieHeader: string): Map<string, string>;
|
|
|
329
327
|
declare const serializeCookie: (key: string, value: string, opt?: CookieOptions) => string;
|
|
330
328
|
declare const serializeSignedCookie: (key: string, value: string, secret: string, opt?: CookieOptions) => Promise<string>;
|
|
331
329
|
|
|
330
|
+
/** The Standard Schema interface. */
|
|
331
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
332
|
+
/** The Standard Schema properties. */
|
|
333
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
334
|
+
}
|
|
335
|
+
declare namespace StandardSchemaV1 {
|
|
336
|
+
/** The Standard Schema properties interface. */
|
|
337
|
+
interface Props<Input = unknown, Output = Input> {
|
|
338
|
+
/** The version number of the standard. */
|
|
339
|
+
readonly version: 1;
|
|
340
|
+
/** The vendor name of the schema library. */
|
|
341
|
+
readonly vendor: string;
|
|
342
|
+
/** Validates unknown input values. */
|
|
343
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
344
|
+
/** Inferred types associated with the schema. */
|
|
345
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
346
|
+
}
|
|
347
|
+
/** The result interface of the validate function. */
|
|
348
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
349
|
+
/** The result interface if validation succeeds. */
|
|
350
|
+
interface SuccessResult<Output> {
|
|
351
|
+
/** The typed output value. */
|
|
352
|
+
readonly value: Output;
|
|
353
|
+
/** The non-existent issues. */
|
|
354
|
+
readonly issues?: undefined;
|
|
355
|
+
}
|
|
356
|
+
/** The result interface if validation fails. */
|
|
357
|
+
interface FailureResult {
|
|
358
|
+
/** The issues of failed validation. */
|
|
359
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
360
|
+
}
|
|
361
|
+
/** The issue interface of the failure output. */
|
|
362
|
+
interface Issue {
|
|
363
|
+
/** The error message of the issue. */
|
|
364
|
+
readonly message: string;
|
|
365
|
+
/** The path of the issue, if any. */
|
|
366
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
367
|
+
}
|
|
368
|
+
/** The path segment interface of the issue. */
|
|
369
|
+
interface PathSegment {
|
|
370
|
+
/** The key representing a path segment. */
|
|
371
|
+
readonly key: PropertyKey;
|
|
372
|
+
}
|
|
373
|
+
/** The Standard Schema types interface. */
|
|
374
|
+
interface Types<Input = unknown, Output = Input> {
|
|
375
|
+
/** The input type of the schema. */
|
|
376
|
+
readonly input: Input;
|
|
377
|
+
/** The output type of the schema. */
|
|
378
|
+
readonly output: Output;
|
|
379
|
+
}
|
|
380
|
+
/** Infers the input type of a Standard Schema. */
|
|
381
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
382
|
+
/** Infers the output type of a Standard Schema. */
|
|
383
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
384
|
+
}
|
|
385
|
+
|
|
332
386
|
type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
333
387
|
type Method = HTTPMethod | "*";
|
|
334
388
|
type InferBodyInput<Options extends EndpointOptions | MiddlewareOptions> = Options["metadata"] extends {
|
|
@@ -430,7 +484,7 @@ declare const createInternalContext: (context: InputContext<any, any>, { options
|
|
|
430
484
|
status?: number;
|
|
431
485
|
headers?: Record<string, string>;
|
|
432
486
|
response?: Response;
|
|
433
|
-
body?: Record<string,
|
|
487
|
+
body?: Record<string, any>;
|
|
434
488
|
} | Response) => Record<string, any>;
|
|
435
489
|
responseHeaders: Headers;
|
|
436
490
|
asResponse?: boolean | undefined;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
-
|
|
3
1
|
declare const _statusCode: {
|
|
4
2
|
OK: number;
|
|
5
3
|
CREATED: number;
|
|
@@ -329,6 +327,62 @@ declare function parseCookies(cookieHeader: string): Map<string, string>;
|
|
|
329
327
|
declare const serializeCookie: (key: string, value: string, opt?: CookieOptions) => string;
|
|
330
328
|
declare const serializeSignedCookie: (key: string, value: string, secret: string, opt?: CookieOptions) => Promise<string>;
|
|
331
329
|
|
|
330
|
+
/** The Standard Schema interface. */
|
|
331
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
332
|
+
/** The Standard Schema properties. */
|
|
333
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
334
|
+
}
|
|
335
|
+
declare namespace StandardSchemaV1 {
|
|
336
|
+
/** The Standard Schema properties interface. */
|
|
337
|
+
interface Props<Input = unknown, Output = Input> {
|
|
338
|
+
/** The version number of the standard. */
|
|
339
|
+
readonly version: 1;
|
|
340
|
+
/** The vendor name of the schema library. */
|
|
341
|
+
readonly vendor: string;
|
|
342
|
+
/** Validates unknown input values. */
|
|
343
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
344
|
+
/** Inferred types associated with the schema. */
|
|
345
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
346
|
+
}
|
|
347
|
+
/** The result interface of the validate function. */
|
|
348
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
349
|
+
/** The result interface if validation succeeds. */
|
|
350
|
+
interface SuccessResult<Output> {
|
|
351
|
+
/** The typed output value. */
|
|
352
|
+
readonly value: Output;
|
|
353
|
+
/** The non-existent issues. */
|
|
354
|
+
readonly issues?: undefined;
|
|
355
|
+
}
|
|
356
|
+
/** The result interface if validation fails. */
|
|
357
|
+
interface FailureResult {
|
|
358
|
+
/** The issues of failed validation. */
|
|
359
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
360
|
+
}
|
|
361
|
+
/** The issue interface of the failure output. */
|
|
362
|
+
interface Issue {
|
|
363
|
+
/** The error message of the issue. */
|
|
364
|
+
readonly message: string;
|
|
365
|
+
/** The path of the issue, if any. */
|
|
366
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
367
|
+
}
|
|
368
|
+
/** The path segment interface of the issue. */
|
|
369
|
+
interface PathSegment {
|
|
370
|
+
/** The key representing a path segment. */
|
|
371
|
+
readonly key: PropertyKey;
|
|
372
|
+
}
|
|
373
|
+
/** The Standard Schema types interface. */
|
|
374
|
+
interface Types<Input = unknown, Output = Input> {
|
|
375
|
+
/** The input type of the schema. */
|
|
376
|
+
readonly input: Input;
|
|
377
|
+
/** The output type of the schema. */
|
|
378
|
+
readonly output: Output;
|
|
379
|
+
}
|
|
380
|
+
/** Infers the input type of a Standard Schema. */
|
|
381
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
382
|
+
/** Infers the output type of a Standard Schema. */
|
|
383
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
384
|
+
}
|
|
385
|
+
|
|
332
386
|
type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
333
387
|
type Method = HTTPMethod | "*";
|
|
334
388
|
type InferBodyInput<Options extends EndpointOptions | MiddlewareOptions> = Options["metadata"] extends {
|
|
@@ -430,7 +484,7 @@ declare const createInternalContext: (context: InputContext<any, any>, { options
|
|
|
430
484
|
status?: number;
|
|
431
485
|
headers?: Record<string, string>;
|
|
432
486
|
response?: Response;
|
|
433
|
-
body?: Record<string,
|
|
487
|
+
body?: Record<string, any>;
|
|
434
488
|
} | Response) => Record<string, any>;
|
|
435
489
|
responseHeaders: Headers;
|
|
436
490
|
asResponse?: boolean | undefined;
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-call",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@arethetypeswrong/cli": "^0.16.4",
|
|
10
|
+
"arktype": "^2.0.0",
|
|
11
|
+
"zod": "^3.24.1",
|
|
12
|
+
"valibot": "1.0.0-beta.15",
|
|
10
13
|
"@biomejs/biome": "^1.8.3",
|
|
11
14
|
"@types/bun": "latest",
|
|
12
15
|
"@types/set-cookie-parser": "^2.4.10",
|
|
@@ -18,13 +21,9 @@
|
|
|
18
21
|
},
|
|
19
22
|
"dependencies": {
|
|
20
23
|
"@better-fetch/fetch": "^1.1.4",
|
|
21
|
-
"@standard-schema/spec": "^1.0.0",
|
|
22
|
-
"arktype": "^2.0.0",
|
|
23
24
|
"rou3": "^0.5.1",
|
|
24
25
|
"set-cookie-parser": "^2.7.1",
|
|
25
|
-
"uncrypto": "^0.1.3"
|
|
26
|
-
"valibot": "1.0.0-beta.15",
|
|
27
|
-
"zod": "^3.24.1"
|
|
26
|
+
"uncrypto": "^0.1.3"
|
|
28
27
|
},
|
|
29
28
|
"exports": {
|
|
30
29
|
".": {
|