@orpc/contract 0.0.0-next.2ebf00e → 0.0.0-next.2f7ecd8
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 +10 -0
- package/dist/index.d.mts +2 -5
- package/dist/index.d.ts +2 -5
- package/dist/index.mjs +5 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -60,6 +60,8 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
60
60
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
61
61
|
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
|
62
62
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
63
|
+
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
|
64
|
+
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
|
63
65
|
|
|
64
66
|
## `@orpc/contract`
|
|
65
67
|
|
|
@@ -98,6 +100,14 @@ export const contract = {
|
|
|
98
100
|
}
|
|
99
101
|
```
|
|
100
102
|
|
|
103
|
+
## Sponsors
|
|
104
|
+
|
|
105
|
+
<p align="center">
|
|
106
|
+
<a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
|
|
107
|
+
<img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
|
|
108
|
+
</a>
|
|
109
|
+
</p>
|
|
110
|
+
|
|
101
111
|
## License
|
|
102
112
|
|
|
103
113
|
Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ORPCErrorCode, ORPCError, ClientContext, Client } from '@orpc/client';
|
|
1
|
+
import { ORPCErrorCode, ORPCError, HTTPMethod, HTTPPath, ClientContext, Client } from '@orpc/client';
|
|
2
2
|
export { ORPCError } from '@orpc/client';
|
|
3
3
|
import { Promisable, IsEqual } from '@orpc/shared';
|
|
4
4
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
@@ -22,7 +22,6 @@ declare class ValidationError extends Error {
|
|
|
22
22
|
interface ErrorMapItem<TDataSchema extends AnySchema> {
|
|
23
23
|
status?: number;
|
|
24
24
|
message?: string;
|
|
25
|
-
description?: string;
|
|
26
25
|
data?: TDataSchema;
|
|
27
26
|
}
|
|
28
27
|
type ErrorMap = {
|
|
@@ -38,8 +37,6 @@ type ErrorFromErrorMap<TErrorMap extends ErrorMap> = Error | ORPCErrorFromErrorM
|
|
|
38
37
|
type Meta = Record<string, any>;
|
|
39
38
|
declare function mergeMeta<T extends Meta>(meta1: T, meta2: T): T;
|
|
40
39
|
|
|
41
|
-
type HTTPPath = `/${string}`;
|
|
42
|
-
type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
43
40
|
type InputStructure = 'compact' | 'detailed';
|
|
44
41
|
type OutputStructure = 'compact' | 'detailed';
|
|
45
42
|
interface Route {
|
|
@@ -233,4 +230,4 @@ type ContractRouterClient<TRouter extends AnyContractRouter, TClientContext exte
|
|
|
233
230
|
[K in keyof TRouter]: TRouter[K] extends AnyContractRouter ? ContractRouterClient<TRouter[K], TClientContext> : never;
|
|
234
231
|
};
|
|
235
232
|
|
|
236
|
-
export { type AnyContractProcedure, type AnyContractRouter, type AnySchema, ContractBuilder, type ContractBuilderDef, type ContractConfig, ContractProcedure, type ContractProcedureBuilder, type ContractProcedureBuilderWithInput, type ContractProcedureBuilderWithInputOutput, type ContractProcedureBuilderWithOutput, type ContractProcedureClient, type ContractProcedureDef, type ContractRouter, type ContractRouterBuilder, type ContractRouterClient, type EnhanceContractRouterOptions, type EnhanceRouteOptions, type EnhancedContractRouter, type ErrorFromErrorMap, type ErrorMap, type ErrorMapItem, type EventIteratorSchemaDetails, type
|
|
233
|
+
export { type AnyContractProcedure, type AnyContractRouter, type AnySchema, ContractBuilder, type ContractBuilderDef, type ContractConfig, ContractProcedure, type ContractProcedureBuilder, type ContractProcedureBuilderWithInput, type ContractProcedureBuilderWithInputOutput, type ContractProcedureBuilderWithOutput, type ContractProcedureClient, type ContractProcedureDef, type ContractRouter, type ContractRouterBuilder, type ContractRouterClient, type EnhanceContractRouterOptions, type EnhanceRouteOptions, type EnhancedContractRouter, type ErrorFromErrorMap, type ErrorMap, type ErrorMapItem, type EventIteratorSchemaDetails, type InferContractRouterErrorMap, type InferContractRouterInputs, type InferContractRouterMeta, type InferContractRouterOutputs, type InferSchemaInput, type InferSchemaOutput, type InputStructure, type MergedErrorMap, type Meta, type ORPCErrorFromErrorMap, type OutputStructure, type Route, type Schema, type SchemaIssue, type TypeRest, ValidationError, type ValidationErrorOptions, enhanceContractRouter, enhanceRoute, eventIterator, fallbackContractConfig, getContractRouter, getEventIteratorSchemaDetails, isContractProcedure, mergeErrorMap, mergeMeta, mergePrefix, mergeRoute, mergeTags, oc, prefixRoute, type, unshiftTagRoute };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ORPCErrorCode, ORPCError, ClientContext, Client } from '@orpc/client';
|
|
1
|
+
import { ORPCErrorCode, ORPCError, HTTPMethod, HTTPPath, ClientContext, Client } from '@orpc/client';
|
|
2
2
|
export { ORPCError } from '@orpc/client';
|
|
3
3
|
import { Promisable, IsEqual } from '@orpc/shared';
|
|
4
4
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
@@ -22,7 +22,6 @@ declare class ValidationError extends Error {
|
|
|
22
22
|
interface ErrorMapItem<TDataSchema extends AnySchema> {
|
|
23
23
|
status?: number;
|
|
24
24
|
message?: string;
|
|
25
|
-
description?: string;
|
|
26
25
|
data?: TDataSchema;
|
|
27
26
|
}
|
|
28
27
|
type ErrorMap = {
|
|
@@ -38,8 +37,6 @@ type ErrorFromErrorMap<TErrorMap extends ErrorMap> = Error | ORPCErrorFromErrorM
|
|
|
38
37
|
type Meta = Record<string, any>;
|
|
39
38
|
declare function mergeMeta<T extends Meta>(meta1: T, meta2: T): T;
|
|
40
39
|
|
|
41
|
-
type HTTPPath = `/${string}`;
|
|
42
|
-
type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
43
40
|
type InputStructure = 'compact' | 'detailed';
|
|
44
41
|
type OutputStructure = 'compact' | 'detailed';
|
|
45
42
|
interface Route {
|
|
@@ -233,4 +230,4 @@ type ContractRouterClient<TRouter extends AnyContractRouter, TClientContext exte
|
|
|
233
230
|
[K in keyof TRouter]: TRouter[K] extends AnyContractRouter ? ContractRouterClient<TRouter[K], TClientContext> : never;
|
|
234
231
|
};
|
|
235
232
|
|
|
236
|
-
export { type AnyContractProcedure, type AnyContractRouter, type AnySchema, ContractBuilder, type ContractBuilderDef, type ContractConfig, ContractProcedure, type ContractProcedureBuilder, type ContractProcedureBuilderWithInput, type ContractProcedureBuilderWithInputOutput, type ContractProcedureBuilderWithOutput, type ContractProcedureClient, type ContractProcedureDef, type ContractRouter, type ContractRouterBuilder, type ContractRouterClient, type EnhanceContractRouterOptions, type EnhanceRouteOptions, type EnhancedContractRouter, type ErrorFromErrorMap, type ErrorMap, type ErrorMapItem, type EventIteratorSchemaDetails, type
|
|
233
|
+
export { type AnyContractProcedure, type AnyContractRouter, type AnySchema, ContractBuilder, type ContractBuilderDef, type ContractConfig, ContractProcedure, type ContractProcedureBuilder, type ContractProcedureBuilderWithInput, type ContractProcedureBuilderWithInputOutput, type ContractProcedureBuilderWithOutput, type ContractProcedureClient, type ContractProcedureDef, type ContractRouter, type ContractRouterBuilder, type ContractRouterClient, type EnhanceContractRouterOptions, type EnhanceRouteOptions, type EnhancedContractRouter, type ErrorFromErrorMap, type ErrorMap, type ErrorMapItem, type EventIteratorSchemaDetails, type InferContractRouterErrorMap, type InferContractRouterInputs, type InferContractRouterMeta, type InferContractRouterOutputs, type InferSchemaInput, type InferSchemaOutput, type InputStructure, type MergedErrorMap, type Meta, type ORPCErrorFromErrorMap, type OutputStructure, type Route, type Schema, type SchemaIssue, type TypeRest, ValidationError, type ValidationErrorOptions, enhanceContractRouter, enhanceRoute, eventIterator, fallbackContractConfig, getContractRouter, getEventIteratorSchemaDetails, isContractProcedure, mergeErrorMap, mergeMeta, mergePrefix, mergeRoute, mergeTags, oc, prefixRoute, type, unshiftTagRoute };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mapEventIterator, ORPCError } from '@orpc/client';
|
|
1
|
+
import { isORPCErrorStatus, mapEventIterator, ORPCError } from '@orpc/client';
|
|
2
2
|
export { ORPCError } from '@orpc/client';
|
|
3
3
|
import { isAsyncIteratorObject } from '@orpc/shared';
|
|
4
4
|
|
|
@@ -20,11 +20,11 @@ function mergeMeta(meta1, meta2) {
|
|
|
20
20
|
class ContractProcedure {
|
|
21
21
|
"~orpc";
|
|
22
22
|
constructor(def) {
|
|
23
|
-
if (def.route?.successStatus && (def.route.successStatus
|
|
24
|
-
throw new Error("[ContractProcedure]
|
|
23
|
+
if (def.route?.successStatus && isORPCErrorStatus(def.route.successStatus)) {
|
|
24
|
+
throw new Error("[ContractProcedure] Invalid successStatus.");
|
|
25
25
|
}
|
|
26
|
-
if (Object.values(def.errorMap).some((val) => val && val.status && (val.status
|
|
27
|
-
throw new Error("[ContractProcedure]
|
|
26
|
+
if (Object.values(def.errorMap).some((val) => val && val.status && !isORPCErrorStatus(val.status))) {
|
|
27
|
+
throw new Error("[ContractProcedure] Invalid error status code.");
|
|
28
28
|
}
|
|
29
29
|
this["~orpc"] = def;
|
|
30
30
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/contract",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.2f7ecd8",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@standard-schema/spec": "^1.0.0",
|
|
28
|
-
"@orpc/client": "0.0.0-next.
|
|
29
|
-
"@orpc/shared": "0.0.0-next.
|
|
30
|
-
"@orpc/standard-server": "0.0.0-next.
|
|
28
|
+
"@orpc/client": "0.0.0-next.2f7ecd8",
|
|
29
|
+
"@orpc/shared": "0.0.0-next.2f7ecd8",
|
|
30
|
+
"@orpc/standard-server": "0.0.0-next.2f7ecd8"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"arktype": "2.0.0-rc.26",
|