@orpc/trpc 0.0.0-next.61aed82 → 0.0.0-next.62c9665
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 +14 -10
- package/dist/index.mjs +11 -21
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<image align="center" src="https://orpc.
|
|
2
|
+
<image align="center" src="https://orpc.dev/logo.webp" width=280 alt="oRPC logo" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
<h1></h1>
|
|
6
6
|
|
|
7
7
|
<div align="center">
|
|
8
|
-
<a href="https://codecov.io/gh/
|
|
9
|
-
<img alt="codecov" src="https://codecov.io/gh/
|
|
8
|
+
<a href="https://codecov.io/gh/middleapi/orpc">
|
|
9
|
+
<img alt="codecov" src="https://codecov.io/gh/middleapi/orpc/branch/main/graph/badge.svg">
|
|
10
10
|
</a>
|
|
11
11
|
<a href="https://www.npmjs.com/package/@orpc/trpc">
|
|
12
12
|
<img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Ftrpc?logo=npm" />
|
|
13
13
|
</a>
|
|
14
|
-
<a href="https://github.com/
|
|
15
|
-
<img alt="MIT License" src="https://img.shields.io/github/license/
|
|
14
|
+
<a href="https://github.com/middleapi/orpc/blob/main/LICENSE">
|
|
15
|
+
<img alt="MIT License" src="https://img.shields.io/github/license/middleapi/orpc?logo=open-source-initiative" />
|
|
16
16
|
</a>
|
|
17
17
|
<a href="https://discord.gg/TXEbwRBvQn">
|
|
18
18
|
<img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
|
|
19
19
|
</a>
|
|
20
|
+
<a href="https://deepwiki.com/middleapi/orpc">
|
|
21
|
+
<img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
|
|
22
|
+
</a>
|
|
20
23
|
</div>
|
|
21
24
|
|
|
22
25
|
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
|
@@ -31,7 +34,7 @@
|
|
|
31
34
|
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
|
32
35
|
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
|
33
36
|
- **🔍 First-Class OpenTelemetry**: Seamlessly integrate with OpenTelemetry for observability.
|
|
34
|
-
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), Pinia Colada, and more.
|
|
37
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), SWR, Pinia Colada, and more.
|
|
35
38
|
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
|
36
39
|
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
|
37
40
|
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
|
@@ -42,7 +45,7 @@
|
|
|
42
45
|
|
|
43
46
|
## Documentation
|
|
44
47
|
|
|
45
|
-
You can find the full documentation [here](https://orpc.
|
|
48
|
+
You can find the full documentation [here](https://orpc.dev).
|
|
46
49
|
|
|
47
50
|
## Packages
|
|
48
51
|
|
|
@@ -54,6 +57,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
54
57
|
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
|
|
55
58
|
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
|
56
59
|
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
|
|
60
|
+
- [@orpc/experimental-react-swr](https://www.npmjs.com/package/@orpc/experimental-react-swr): [SWR](https://swr.vercel.app/) integration.
|
|
57
61
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
58
62
|
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
|
59
63
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
@@ -67,11 +71,11 @@ Bridge between [tRPC](https://trpc.io/) and oRPC
|
|
|
67
71
|
## Sponsors
|
|
68
72
|
|
|
69
73
|
<p align="center">
|
|
70
|
-
<a href="https://cdn.jsdelivr.net/gh/
|
|
71
|
-
<img src='https://cdn.jsdelivr.net/gh/
|
|
74
|
+
<a href="https://cdn.jsdelivr.net/gh/dinwwwh/dinwwwh/sponsors.svg">
|
|
75
|
+
<img src='https://cdn.jsdelivr.net/gh/dinwwwh/dinwwwh/sponsors.svg'/>
|
|
72
76
|
</a>
|
|
73
77
|
</p>
|
|
74
78
|
|
|
75
79
|
## License
|
|
76
80
|
|
|
77
|
-
Distributed under the MIT License. See [LICENSE](https://github.com/
|
|
81
|
+
Distributed under the MIT License. See [LICENSE](https://github.com/middleapi/orpc/blob/main/LICENSE) for more information.
|
package/dist/index.mjs
CHANGED
|
@@ -38,12 +38,14 @@ function toORPCProcedure(procedure) {
|
|
|
38
38
|
return new ORPC.Procedure({
|
|
39
39
|
errorMap: {},
|
|
40
40
|
meta: procedure._def.meta ?? {},
|
|
41
|
-
inputValidationIndex: 0,
|
|
42
|
-
outputValidationIndex: 0,
|
|
43
41
|
route: get(procedure._def.meta, ["route"]) ?? {},
|
|
44
42
|
middlewares: [],
|
|
45
|
-
inputSchema:
|
|
46
|
-
outputSchema:
|
|
43
|
+
inputSchema: toStandardSchema(procedure._def.inputs.at(-1)),
|
|
44
|
+
outputSchema: toStandardSchema(procedure._def.output),
|
|
45
|
+
inputValidationIndex: Number.NaN,
|
|
46
|
+
// disable input validation
|
|
47
|
+
outputValidationIndex: Number.NaN,
|
|
48
|
+
// disable output validation
|
|
47
49
|
handler: async ({ context, signal, path, input, lastEventId }) => {
|
|
48
50
|
try {
|
|
49
51
|
const trpcInput = lastEventId !== void 0 && (input === void 0 || isObject(input)) ? { ...input, lastEventId } : input;
|
|
@@ -53,7 +55,9 @@ function toORPCProcedure(procedure) {
|
|
|
53
55
|
path: path.join("."),
|
|
54
56
|
type: procedure._def.type,
|
|
55
57
|
input: trpcInput,
|
|
56
|
-
getRawInput: () => trpcInput
|
|
58
|
+
getRawInput: () => trpcInput,
|
|
59
|
+
// TODO: this should infer from context when using oRPC Batch Plugin
|
|
60
|
+
batchIndex: 0
|
|
57
61
|
});
|
|
58
62
|
if (isAsyncIterable(output)) {
|
|
59
63
|
return mapEventIterator(output[Symbol.asyncIterator](), {
|
|
@@ -86,25 +90,11 @@ function toORPCProcedure(procedure) {
|
|
|
86
90
|
}
|
|
87
91
|
});
|
|
88
92
|
}
|
|
89
|
-
function
|
|
93
|
+
function toStandardSchema(schema) {
|
|
90
94
|
if (!isTypescriptObject(schema) || !("~standard" in schema) || !isTypescriptObject(schema["~standard"])) {
|
|
91
95
|
return void 0;
|
|
92
96
|
}
|
|
93
|
-
return
|
|
94
|
-
get: (target, prop) => {
|
|
95
|
-
if (prop === "~standard") {
|
|
96
|
-
return new Proxy(target["~standard"], {
|
|
97
|
-
get: (target2, prop2) => {
|
|
98
|
-
if (prop2 === "validate") {
|
|
99
|
-
return (value) => ({ value });
|
|
100
|
-
}
|
|
101
|
-
return Reflect.get(target2, prop2, target2);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return Reflect.get(target, prop, target);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
97
|
+
return schema;
|
|
108
98
|
}
|
|
109
99
|
|
|
110
100
|
export { toORPCRouter };
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/trpc",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.62c9665",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://orpc.
|
|
6
|
+
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
9
|
+
"url": "git+https://github.com/middleapi/orpc.git",
|
|
10
10
|
"directory": "packages/trpc"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
|
-
"unnoq",
|
|
14
13
|
"orpc",
|
|
15
14
|
"trpc"
|
|
16
15
|
],
|
|
@@ -28,13 +27,13 @@
|
|
|
28
27
|
"@trpc/server": ">=11.4.2"
|
|
29
28
|
},
|
|
30
29
|
"dependencies": {
|
|
31
|
-
"@orpc/
|
|
32
|
-
"@orpc/
|
|
33
|
-
"@orpc/
|
|
30
|
+
"@orpc/server": "0.0.0-next.62c9665",
|
|
31
|
+
"@orpc/shared": "0.0.0-next.62c9665",
|
|
32
|
+
"@orpc/client": "0.0.0-next.62c9665"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|
|
36
|
-
"@trpc/server": "^11.
|
|
37
|
-
"zod": "^4.
|
|
35
|
+
"@trpc/server": "^11.12.0",
|
|
36
|
+
"zod": "^4.3.6"
|
|
38
37
|
},
|
|
39
38
|
"scripts": {
|
|
40
39
|
"build": "unbuild",
|