@orpc/contract 1.0.0-beta.4 → 1.0.0-beta.5
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 +1 -0
- package/dist/index.d.mts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.mjs +5 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -53,6 +53,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
53
53
|
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
|
54
54
|
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
|
55
55
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
|
56
|
+
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
|
56
57
|
- [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
|
|
57
58
|
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
|
58
59
|
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ORPCErrorCode, ORPCError, ClientContext, Client } from '@orpc/client';
|
|
2
|
-
export { ORPCError } from '@orpc/client';
|
|
3
|
-
import { Promisable, IsEqual } from '@orpc/shared';
|
|
1
|
+
import { ORPCErrorCode, ORPCError, HTTPMethod, HTTPPath, ClientContext, Client } from '@orpc/client';
|
|
2
|
+
export { HTTPMethod, HTTPPath, ORPCError } from '@orpc/client';
|
|
3
|
+
import { Promisable, IsEqual, ThrowableError } from '@orpc/shared';
|
|
4
|
+
export { Registry, ThrowableError } from '@orpc/shared';
|
|
4
5
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
5
6
|
|
|
6
7
|
type Schema<TInput, TOutput> = StandardSchemaV1<TInput, TOutput>;
|
|
@@ -32,13 +33,11 @@ declare function mergeErrorMap<T1 extends ErrorMap, T2 extends ErrorMap>(errorMa
|
|
|
32
33
|
type ORPCErrorFromErrorMap<TErrorMap extends ErrorMap> = {
|
|
33
34
|
[K in keyof TErrorMap]: K extends string ? TErrorMap[K] extends ErrorMapItem<infer TDataSchema extends Schema<unknown, unknown>> ? ORPCError<K, InferSchemaOutput<TDataSchema>> : never : never;
|
|
34
35
|
}[keyof TErrorMap];
|
|
35
|
-
type ErrorFromErrorMap<TErrorMap extends ErrorMap> =
|
|
36
|
+
type ErrorFromErrorMap<TErrorMap extends ErrorMap> = ORPCErrorFromErrorMap<TErrorMap> | ThrowableError;
|
|
36
37
|
|
|
37
38
|
type Meta = Record<string, any>;
|
|
38
39
|
declare function mergeMeta<T extends Meta>(meta1: T, meta2: T): T;
|
|
39
40
|
|
|
40
|
-
type HTTPPath = `/${string}`;
|
|
41
|
-
type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
42
41
|
type InputStructure = 'compact' | 'detailed';
|
|
43
42
|
type OutputStructure = 'compact' | 'detailed';
|
|
44
43
|
interface Route {
|
|
@@ -232,4 +231,4 @@ type ContractRouterClient<TRouter extends AnyContractRouter, TClientContext exte
|
|
|
232
231
|
[K in keyof TRouter]: TRouter[K] extends AnyContractRouter ? ContractRouterClient<TRouter[K], TClientContext> : never;
|
|
233
232
|
};
|
|
234
233
|
|
|
235
|
-
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
|
|
234
|
+
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,6 +1,7 @@
|
|
|
1
|
-
import { ORPCErrorCode, ORPCError, ClientContext, Client } from '@orpc/client';
|
|
2
|
-
export { ORPCError } from '@orpc/client';
|
|
3
|
-
import { Promisable, IsEqual } from '@orpc/shared';
|
|
1
|
+
import { ORPCErrorCode, ORPCError, HTTPMethod, HTTPPath, ClientContext, Client } from '@orpc/client';
|
|
2
|
+
export { HTTPMethod, HTTPPath, ORPCError } from '@orpc/client';
|
|
3
|
+
import { Promisable, IsEqual, ThrowableError } from '@orpc/shared';
|
|
4
|
+
export { Registry, ThrowableError } from '@orpc/shared';
|
|
4
5
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
5
6
|
|
|
6
7
|
type Schema<TInput, TOutput> = StandardSchemaV1<TInput, TOutput>;
|
|
@@ -32,13 +33,11 @@ declare function mergeErrorMap<T1 extends ErrorMap, T2 extends ErrorMap>(errorMa
|
|
|
32
33
|
type ORPCErrorFromErrorMap<TErrorMap extends ErrorMap> = {
|
|
33
34
|
[K in keyof TErrorMap]: K extends string ? TErrorMap[K] extends ErrorMapItem<infer TDataSchema extends Schema<unknown, unknown>> ? ORPCError<K, InferSchemaOutput<TDataSchema>> : never : never;
|
|
34
35
|
}[keyof TErrorMap];
|
|
35
|
-
type ErrorFromErrorMap<TErrorMap extends ErrorMap> =
|
|
36
|
+
type ErrorFromErrorMap<TErrorMap extends ErrorMap> = ORPCErrorFromErrorMap<TErrorMap> | ThrowableError;
|
|
36
37
|
|
|
37
38
|
type Meta = Record<string, any>;
|
|
38
39
|
declare function mergeMeta<T extends Meta>(meta1: T, meta2: T): T;
|
|
39
40
|
|
|
40
|
-
type HTTPPath = `/${string}`;
|
|
41
|
-
type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
42
41
|
type InputStructure = 'compact' | 'detailed';
|
|
43
42
|
type OutputStructure = 'compact' | 'detailed';
|
|
44
43
|
interface Route {
|
|
@@ -232,4 +231,4 @@ type ContractRouterClient<TRouter extends AnyContractRouter, TClientContext exte
|
|
|
232
231
|
[K in keyof TRouter]: TRouter[K] extends AnyContractRouter ? ContractRouterClient<TRouter[K], TClientContext> : never;
|
|
233
232
|
};
|
|
234
233
|
|
|
235
|
-
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
|
|
234
|
+
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": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.5",
|
|
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/
|
|
29
|
-
"@orpc/
|
|
30
|
-
"@orpc/
|
|
28
|
+
"@orpc/client": "1.0.0-beta.5",
|
|
29
|
+
"@orpc/shared": "1.0.0-beta.5",
|
|
30
|
+
"@orpc/standard-server": "1.0.0-beta.5"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"arktype": "2.0.0-rc.26",
|