@orpc/contract 2.0.0-beta.48 → 2.0.0-beta.49
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 +4 -4
- package/dist/builder-variants.d.ts +103 -0
- package/dist/builder.d.ts +78 -0
- package/dist/builder.js +112 -0
- package/dist/client-factory.d.ts +24 -0
- package/dist/client-factory.js +38 -0
- package/dist/error-factory.d.ts +80 -0
- package/dist/error-factory.js +121 -0
- package/dist/error-utils.d.ts +5 -0
- package/dist/error-utils.js +40 -0
- package/dist/error.d.ts +45 -0
- package/dist/error.js +20 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.js +31 -0
- package/dist/meta-built-in.d.ts +30 -0
- package/dist/meta-built-in.js +54 -0
- package/dist/meta-utils.d.ts +58 -0
- package/dist/meta-utils.js +76 -0
- package/dist/meta.d.ts +53 -0
- package/dist/meta.js +13 -0
- package/dist/plugins/index.d.ts +12 -0
- package/dist/plugins/index.js +12 -0
- package/dist/plugins/request-validation.d.ts +28 -0
- package/dist/plugins/request-validation.js +55 -0
- package/dist/plugins/response-validation.d.ts +15 -0
- package/dist/plugins/response-validation.js +72 -0
- package/dist/procedure-client.d.ts +5 -0
- package/dist/procedure.d.ts +28 -0
- package/dist/procedure.js +28 -0
- package/dist/router-client.d.ts +13 -0
- package/dist/router-utils.d.ts +30 -0
- package/dist/router-utils.js +79 -0
- package/dist/router.d.ts +52 -0
- package/dist/schema-built-in.d.ts +23 -0
- package/dist/schema-built-in.js +76 -0
- package/dist/schema-utils.d.ts +20 -0
- package/dist/schema-utils.js +44 -0
- package/dist/schema.d.ts +25 -0
- package/package.json +28 -30
- package/dist/builder-variants.d.mts +0 -113
- package/dist/builder.d.mts +0 -78
- package/dist/builder.mjs +0 -71
- package/dist/client-factory.d.mts +0 -24
- package/dist/client-factory.mjs +0 -34
- package/dist/error-factory.d.mts +0 -87
- package/dist/error-factory.mjs +0 -75
- package/dist/error-utils.d.mts +0 -11
- package/dist/error-utils.mjs +0 -43
- package/dist/error.d.mts +0 -41
- package/dist/error.mjs +0 -12
- package/dist/index.d.mts +0 -62
- package/dist/index.mjs +0 -25
- package/dist/meta-built-in.d.mts +0 -38
- package/dist/meta-built-in.mjs +0 -40
- package/dist/meta-utils.d.mts +0 -62
- package/dist/meta-utils.mjs +0 -33
- package/dist/meta.d.mts +0 -61
- package/dist/meta.mjs +0 -11
- package/dist/plugins/index.d.mts +0 -12
- package/dist/plugins/index.mjs +0 -8
- package/dist/plugins/request-validation.d.mts +0 -28
- package/dist/plugins/request-validation.mjs +0 -46
- package/dist/plugins/response-validation.d.mts +0 -15
- package/dist/plugins/response-validation.mjs +0 -53
- package/dist/procedure-client.d.mts +0 -10
- package/dist/procedure.d.mts +0 -36
- package/dist/procedure.mjs +0 -19
- package/dist/router-client.d.mts +0 -14
- package/dist/router-utils.d.mts +0 -34
- package/dist/router-utils.mjs +0 -67
- package/dist/router.d.mts +0 -42
- package/dist/schema-built-in.d.mts +0 -28
- package/dist/schema-built-in.mjs +0 -73
- package/dist/schema-utils.d.mts +0 -26
- package/dist/schema-utils.mjs +0 -29
- package/dist/schema.d.mts +0 -31
- /package/dist/{builder-variants.mjs → builder-variants.js} +0 -0
- /package/dist/{procedure-client.mjs → procedure-client.js} +0 -0
- /package/dist/{router-client.mjs → router-client.js} +0 -0
- /package/dist/{router.mjs → router.js} +0 -0
- /package/dist/{schema.mjs → schema.js} +0 -0
package/dist/schema-utils.d.mts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { IsEqual, Promisable } from "@orpc/shared";
|
|
2
|
-
import type { Schema, SchemaIssue } from "./schema.mjs";
|
|
3
|
-
export type TypeRest<
|
|
4
|
-
TInput,
|
|
5
|
-
TOutput
|
|
6
|
-
> = [map: (input: TInput) => Promisable<TOutput>] | (IsEqual<TInput, TOutput> extends true ? [] : never);
|
|
7
|
-
/**
|
|
8
|
-
* Create a schema for things can be trust without validation.
|
|
9
|
-
* You can optionally pass a map function for mapping
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* const normal = type<number>()
|
|
14
|
-
* const withMap = type<number, string>(input => input.toString())
|
|
15
|
-
*```
|
|
16
|
-
*
|
|
17
|
-
* @see {@link https://orpc.dev/docs/procedure#type-utility | Procedure - type Utility}
|
|
18
|
-
*/
|
|
19
|
-
export declare function type<
|
|
20
|
-
TInput,
|
|
21
|
-
TOutput = TInput
|
|
22
|
-
>(...[map]: TypeRest<TInput, TOutput>): Schema<TInput, TOutput>;
|
|
23
|
-
/**
|
|
24
|
-
* Check if the given issue is following the standard-schema issue format.
|
|
25
|
-
*/
|
|
26
|
-
export declare function isSchemaIssue(issue: unknown): issue is SchemaIssue;
|
package/dist/schema-utils.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { isPropertyKey, isTypescriptObject, ORPC_NAME } from "@orpc/shared";
|
|
2
|
-
|
|
3
|
-
export function type(...[map]) {
|
|
4
|
-
return { "~standard": {
|
|
5
|
-
vendor: ORPC_NAME,
|
|
6
|
-
version: 1,
|
|
7
|
-
async validate(value) {
|
|
8
|
-
if (map) {
|
|
9
|
-
return { value: await map(value) };
|
|
10
|
-
}
|
|
11
|
-
return { value };
|
|
12
|
-
}
|
|
13
|
-
} };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function isSchemaIssue(issue) {
|
|
17
|
-
if (!isTypescriptObject(issue) || typeof issue.message !== "string") {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
if (issue.path !== undefined) {
|
|
21
|
-
if (!Array.isArray(issue.path)) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
if (!issue.path.every((segment) => isPropertyKey(segment) || isTypescriptObject(segment) && isPropertyKey(segment.key))) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
}
|
package/dist/schema.d.mts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
-
/**
|
|
3
|
-
* TOutput default = TInput for better readability (shorter) in-case both TInput, TOutput is equal
|
|
4
|
-
*/
|
|
5
|
-
export type Schema<
|
|
6
|
-
TInput,
|
|
7
|
-
TOutput = TInput
|
|
8
|
-
> = StandardSchemaV1<TInput, TOutput>;
|
|
9
|
-
/**
|
|
10
|
-
* Any Standard Schema compatible schema, regardless of its input and output types.
|
|
11
|
-
*
|
|
12
|
-
* @see {@link https://orpc.dev/docs/integrations/standard-schema | Standard Schema Integration}
|
|
13
|
-
*/
|
|
14
|
-
export type AnySchema = Schema<any>;
|
|
15
|
-
export type SchemaIssue = StandardSchemaV1.Issue;
|
|
16
|
-
/**
|
|
17
|
-
* Infers the input type of a schema.
|
|
18
|
-
*
|
|
19
|
-
* @see {@link https://orpc.dev/docs/metadata | Metadata}
|
|
20
|
-
*/
|
|
21
|
-
export type InferSchemaInput<T extends AnySchema> = T extends StandardSchemaV1<infer UInput, any> ? UInput : never;
|
|
22
|
-
/**
|
|
23
|
-
* Infers the output type of a schema.
|
|
24
|
-
*
|
|
25
|
-
* @see {@link https://orpc.dev/docs/metadata | Metadata}
|
|
26
|
-
*/
|
|
27
|
-
export type InferSchemaOutput<T extends AnySchema> = T extends StandardSchemaV1<any, infer UOutput> ? UOutput : never;
|
|
28
|
-
export type MergedSchema<
|
|
29
|
-
T extends AnySchema,
|
|
30
|
-
U extends AnySchema
|
|
31
|
-
> = T extends Schema<infer TInput, infer TOutput> ? U extends Schema<infer UInput, infer UOutput> ? Schema<TInput & UInput, TOutput & UOutput> : never : never;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|