@orpc/contract 2.0.0-beta.34 → 2.0.0-beta.36
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
CHANGED
|
@@ -46,29 +46,30 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
46
46
|
|
|
47
47
|
**Built-in features**
|
|
48
48
|
|
|
49
|
-
| Package
|
|
50
|
-
|
|
|
51
|
-
| [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher)
|
|
52
|
-
| [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit)
|
|
53
|
-
| [@orpc/
|
|
54
|
-
| [@orpc/
|
|
49
|
+
| Package | Purpose | Docs |
|
|
50
|
+
| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
51
|
+
| [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher) | Pub/Sub with memory, Redis, and Upstash adapters. | [Publisher](https://orpc.dev/docs/helpers/publisher) |
|
|
52
|
+
| [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit) | Rate limiting with memory, Redis, and Upstash adapters. | [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
|
|
53
|
+
| [@orpc/experimental-lock](https://www.npmjs.com/package/@orpc/experimental-lock) | Locking with memory, Redis, and Upstash adapters. | [Lock](https://orpc.dev/docs/helpers/lock) |
|
|
54
|
+
| [@orpc/hibernation](https://www.npmjs.com/package/@orpc/hibernation) | Leverage Hibernation APIs like [Cloudflare's Hibernation WebSocket](https://developers.cloudflare.com/durable-objects/best-practices/websockets/#durable-objects-hibernation-websocket-api). | [Hibernation](https://orpc.dev/docs/integrations/hibernation) |
|
|
55
|
+
| [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema) | Smart coercion for OpenAPI requests. | [Smart Coercion](https://orpc.dev/docs/plugins/smart-coercion) |
|
|
55
56
|
|
|
56
57
|
**Framework & ecosystem integrations**
|
|
57
58
|
|
|
58
|
-
| Package | Purpose
|
|
59
|
-
| ------------------------------------------------------------------------------------ |
|
|
60
|
-
| [@orpc/next](https://www.npmjs.com/package/@orpc/next) | Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
|
|
61
|
-
| [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk) | Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools.
|
|
62
|
-
| [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query) | Integrate with [TanStack Query](https://tanstack.com/query/latest).
|
|
63
|
-
| [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada) | Integrate with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
64
|
-
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/).
|
|
65
|
-
| [@orpc/experimental-msw](https://www.npmjs.com/package/@orpc/experimental-msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/).
|
|
66
|
-
| [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/).
|
|
67
|
-
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/).
|
|
68
|
-
| [@orpc/node](https://www.npmjs.com/package/@orpc/node) | [Node.js](https://nodejs.org/) plugins for static file serving and large uploads.
|
|
69
|
-
| [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/).
|
|
70
|
-
| [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare
|
|
71
|
-
| [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc) | Reuse existing [tRPC](https://trpc.io/) routers within oRPC.
|
|
59
|
+
| Package | Purpose | Docs |
|
|
60
|
+
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
61
|
+
| [@orpc/next](https://www.npmjs.com/package/@orpc/next) | Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data). | [Next.js](https://orpc.dev/docs/integrations/next) |
|
|
62
|
+
| [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk) | Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools. | [AI SDK](https://orpc.dev/docs/integrations/ai-sdk) |
|
|
63
|
+
| [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query) | Integrate with [TanStack Query](https://tanstack.com/query/latest). | [TanStack Query](https://orpc.dev/docs/integrations/tanstack-query) |
|
|
64
|
+
| [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada) | Integrate with [Pinia Colada](https://pinia-colada.esm.dev/). | [Pinia Colada](https://orpc.dev/docs/integrations/pinia-colada) |
|
|
65
|
+
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/). | [SWR](https://orpc.dev/docs/integrations/swr) |
|
|
66
|
+
| [@orpc/experimental-msw](https://www.npmjs.com/package/@orpc/experimental-msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/). | [MSW](https://orpc.dev/docs/integrations/msw) |
|
|
67
|
+
| [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/). | [Effect](https://orpc.dev/docs/integrations/effect) |
|
|
68
|
+
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/). | [NestJS](https://orpc.dev/docs/integrations/nest) |
|
|
69
|
+
| [@orpc/node](https://www.npmjs.com/package/@orpc/node) | [Node.js](https://nodejs.org/) plugins for static file serving and large uploads. | [Static File](https://orpc.dev/docs/plugins/static-file), [Tmp File Upload](https://orpc.dev/docs/plugins/tmp-file-upload), [Batch Response Compression](https://orpc.dev/docs/plugins/batch-response-compression) |
|
|
70
|
+
| [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Lock](https://orpc.dev/docs/helpers/lock) |
|
|
71
|
+
| [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare Workers](https://developers.cloudflare.com/workers/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit), [Lock](https://orpc.dev/docs/helpers/lock), [Traces](https://orpc.dev/docs/integrations/cloudflare-traces) |
|
|
72
|
+
| [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc) | Reuse existing [tRPC](https://trpc.io/) routers within oRPC. | [tRPC](https://orpc.dev/docs/integrations/trpc) |
|
|
72
73
|
|
|
73
74
|
**Observability**
|
|
74
75
|
|
|
@@ -94,6 +95,14 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
94
95
|
</tr>
|
|
95
96
|
</table>
|
|
96
97
|
|
|
98
|
+
### Special Sponsors
|
|
99
|
+
|
|
100
|
+
<table>
|
|
101
|
+
<tr>
|
|
102
|
+
<td align="center"><a href="http://twitter.com/rauchg?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Guillermo Rauch"><img src="https://avatars.githubusercontent.com/u/13041?u=1ee8d111657cdd02ff6d253df00978d17ee6d722&v=4" width="279" alt="Guillermo Rauch"/><br />Guillermo Rauch</a></td>
|
|
103
|
+
</tr>
|
|
104
|
+
</table>
|
|
105
|
+
|
|
97
106
|
### Organization Sponsors
|
|
98
107
|
|
|
99
108
|
<table>
|
|
@@ -127,6 +136,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
127
136
|
<td align="center"><a href="https://github.com/ellis-driscoll?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Ellis Driscoll"><img src="https://avatars.githubusercontent.com/u/70685966?u=c5f95bc33b5991d9744abe00052542e4a2ed3cb9&v=4" width="139" alt="Ellis Driscoll"/><br />Ellis Driscoll</a></td>
|
|
128
137
|
<td align="center"><a href="https://github.com/hoangbn?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Hoang Nguyen"><img src="https://avatars.githubusercontent.com/u/38968280?u=c90084c6de65c56facabab7ba13a72a49ddbc3e4&v=4" width="139" alt="Hoang Nguyen"/><br />Hoang Nguyen</a></td>
|
|
129
138
|
<td align="center"><a href="https://opencollective.com/guest-ac41de3b?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Orestis Ioannou"><img src="https://images.opencollective.com/guest-ac41de3b/avatar/460.png" width="139" alt="Orestis Ioannou"/><br />Orestis Ioannou</a></td>
|
|
139
|
+
<td align="center"><a href="https://automatio.ai/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Stefan Smiljkovic"><img src="https://avatars.githubusercontent.com/u/1984909?u=b7bf5bc40ed49df3c22f69d2da7b8d78709c49ed&v=4" width="139" alt="Stefan Smiljkovic"/><br />Stefan Smiljkovic</a></td>
|
|
130
140
|
</tr>
|
|
131
141
|
</table>
|
|
132
142
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isTypescriptObject, toArray, get, set, isPropertyKey, ORPC_NAME, resolveMaybeOptionalOptions, getOwn, isAsyncIteratorObject } from '@orpc/shared';
|
|
2
|
-
import { P as ProcedureContract, r as resolveMetaPlugins, m as mergeErrorMap, a as augmentContractRouter, V as ValidationError } from './shared/contract.
|
|
3
|
-
export { d as defineMeta, g as getContractRouter, b as getProcedureContractOrThrow, g as getRouterContract, c as minifyContractRouter, c as minifyRouterContract, e as reconcileORPCError } from './shared/contract.
|
|
2
|
+
import { P as ProcedureContract, r as resolveMetaPlugins, m as mergeErrorMap, a as augmentContractRouter, V as ValidationError } from './shared/contract.g7AqmB1o.mjs';
|
|
3
|
+
export { d as defineMeta, g as getContractRouter, b as getProcedureContractOrThrow, g as getRouterContract, c as minifyContractRouter, c as minifyRouterContract, e as reconcileORPCError } from './shared/contract.g7AqmB1o.mjs';
|
|
4
4
|
import { createORPCClient, ORPCError, wrapAsyncIteratorPreservingEventMeta } from '@orpc/client';
|
|
5
5
|
|
|
6
6
|
const HIDDEN_META_PLUGINS_SYMBOL = Symbol.for("ORPC_HIDDEN_META_PLUGINS");
|
|
@@ -142,8 +142,8 @@ function resolveBasePathMeta(contract, currentPath = []) {
|
|
|
142
142
|
return base;
|
|
143
143
|
}
|
|
144
144
|
if (isTypescriptObject(contract)) {
|
|
145
|
-
for (const key
|
|
146
|
-
const base = resolveBasePathMeta(
|
|
145
|
+
for (const [key, child] of Object.entries(contract)) {
|
|
146
|
+
const base = resolveBasePathMeta(child, [...currentPath, key]);
|
|
147
147
|
if (base !== void 0) {
|
|
148
148
|
return base;
|
|
149
149
|
}
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ORPCError } from '@orpc/client';
|
|
2
2
|
import { toArray, isPlainObject, mergeTwoLevels } from '@orpc/shared';
|
|
3
|
-
import { b as getProcedureContractOrThrow, V as ValidationError, e as reconcileORPCError } from '../shared/contract.
|
|
3
|
+
import { b as getProcedureContractOrThrow, V as ValidationError, e as reconcileORPCError } from '../shared/contract.g7AqmB1o.mjs';
|
|
4
4
|
|
|
5
5
|
class RequestValidationLinkPlugin {
|
|
6
6
|
constructor(contract, options = {}) {
|
|
@@ -111,7 +111,7 @@ function augmentContractRouter(router, options) {
|
|
|
111
111
|
return router;
|
|
112
112
|
}
|
|
113
113
|
const enhanced = {};
|
|
114
|
-
for (const key
|
|
114
|
+
for (const key of Object.keys(router)) {
|
|
115
115
|
enhanced[key] = augmentContractRouter(router[key], options);
|
|
116
116
|
}
|
|
117
117
|
return enhanced;
|
|
@@ -154,8 +154,8 @@ function minifyRouterContract(router) {
|
|
|
154
154
|
return router;
|
|
155
155
|
}
|
|
156
156
|
const json = {};
|
|
157
|
-
for (const key
|
|
158
|
-
json[key] = minifyRouterContract(
|
|
157
|
+
for (const [key, child] of Object.entries(router)) {
|
|
158
|
+
json[key] = minifyRouterContract(child);
|
|
159
159
|
}
|
|
160
160
|
return json;
|
|
161
161
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/contract",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.36",
|
|
5
5
|
"description": "Define typesafe API contracts as the single source of truth for oRPC, powered by Standard Schema",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dist"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@orpc/client": "2.0.0-beta.
|
|
47
|
-
"@orpc/shared": "2.0.0-beta.
|
|
46
|
+
"@orpc/client": "2.0.0-beta.36",
|
|
47
|
+
"@orpc/shared": "2.0.0-beta.36",
|
|
48
48
|
"@standard-schema/spec": "^1.1.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"arktype": "^2.2.1",
|
|
52
|
-
"valibot": "^1.
|
|
52
|
+
"valibot": "^1.5.0",
|
|
53
53
|
"zod": "^4.5.4"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|