@orpc/json-schema 2.0.0-beta.23 → 2.0.0-beta.24
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 -1
- package/dist/index.d.mts +28 -0
- package/dist/index.d.ts +28 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -44,6 +44,7 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
44
44
|
|
|
45
45
|
- [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher): Pub/Sub with memory, Redis, and Upstash adapters.
|
|
46
46
|
- [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit): Rate limiting with memory, Redis, and Upstash adapters.
|
|
47
|
+
- [@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).
|
|
47
48
|
- [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema): Smart coercion for OpenAPI requests.
|
|
48
49
|
|
|
49
50
|
**Framework & ecosystem integrations**
|
|
@@ -114,6 +115,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
114
115
|
</tr>
|
|
115
116
|
<tr>
|
|
116
117
|
<td align="center"><a href="https://github.com/itigoore01?ref=orpc" target="_blank" rel="noopener" title="shota"><img src="https://avatars.githubusercontent.com/u/11831107?u=c976a6dc7e055eb026304c46c99100ed22b0c8e0&v=4" width="139" alt="shota"/><br />shota</a></td>
|
|
118
|
+
<td align="center"><a href="https://github.com/ellis-driscoll?ref=orpc" target="_blank" rel="noopener" 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>
|
|
117
119
|
</tr>
|
|
118
120
|
</table>
|
|
119
121
|
|
|
@@ -139,8 +141,9 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
139
141
|
<td align="center"><a href="https://github.com/mr-kelly?ref=orpc" target="_blank" rel="noopener" title="Kelly Peilin Chan"><img src="https://avatars.githubusercontent.com/u/520852?u=6b0f7105f694e7b5cacf410a3f04c7044b469dc8&v=4" width="119" alt="Kelly Peilin Chan"/><br />Kelly Peilin Chan</a></td>
|
|
140
142
|
</tr>
|
|
141
143
|
<tr>
|
|
144
|
+
<td align="center"><a href="https://github.com/guyariely?ref=orpc" target="_blank" rel="noopener" title="Guy Ariely"><img src="https://avatars.githubusercontent.com/u/42813496?u=edb6b7f563bf28e160a290832e7da57c0506f8ca&v=4" width="119" alt="Guy Ariely"/><br />Guy Ariely</a></td>
|
|
142
145
|
<td align="center"><a href="https://github.com/piscis?ref=orpc" target="_blank" rel="noopener" title="Alex"><img src="https://avatars.githubusercontent.com/u/326163?u=b245f368bd940cf51d08c0b6bf55f8257f359437&v=4" width="119" alt="Alex"/><br />Alex</a></td>
|
|
143
|
-
<td align="center"><a href="https://github.com/finom?ref=orpc" target="_blank" rel="noopener" title="Andrey Gubanov"><img src="https://avatars.githubusercontent.com/u/1082083?u=
|
|
146
|
+
<td align="center"><a href="https://github.com/finom?ref=orpc" target="_blank" rel="noopener" title="Andrey Gubanov"><img src="https://avatars.githubusercontent.com/u/1082083?u=c5f2daf7ebece498e85c83367bb37b4e10e2649d&v=4" width="119" alt="Andrey Gubanov"/><br />Andrey Gubanov</a></td>
|
|
144
147
|
</tr>
|
|
145
148
|
</table>
|
|
146
149
|
|
package/dist/index.d.mts
CHANGED
|
@@ -8,6 +8,11 @@ import { ClientContext } from '@orpc/client';
|
|
|
8
8
|
import { StandardLinkPlugin, StandardLinkOptions } from '@orpc/client/standard';
|
|
9
9
|
import { StandardJSONSchemaV1 } from '@standard-schema/spec';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* A JSON Schema (draft 2020-12) representation used across oRPC's JSON schema tooling.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://orpc.dev/docs/integrations/standard-schema | Standard Schema Integration}
|
|
15
|
+
*/
|
|
11
16
|
type JsonSchema<Value = any> = Draft2020.JSONSchema<Value>;
|
|
12
17
|
type JsonSchemaKeywords = typeof Draft2020.keywords[number];
|
|
13
18
|
declare enum JsonSchemaXNativeType {
|
|
@@ -89,7 +94,18 @@ declare function flattenJsonUnionSchema(schema: JsonSchema): JsonSchema[];
|
|
|
89
94
|
declare function matchArrayableJsonSchema(schema: JsonSchema): undefined | [itemSchema: JsonSchema, arraySchema: JsonArraySchema];
|
|
90
95
|
declare function deduplicateJsonSchemas(schemas: JsonSchema[]): JsonSchema[];
|
|
91
96
|
|
|
97
|
+
/**
|
|
98
|
+
* The conversion direction: `input` targets the schema's input type, `output` targets its output type.
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://orpc.dev/docs/integrations/standard-schema | Standard Schema Integration}
|
|
101
|
+
*/
|
|
92
102
|
type JsonSchemaConverterDirection = 'input' | 'output';
|
|
103
|
+
/**
|
|
104
|
+
* Interface for converting validation schemas into JSON Schema representations,
|
|
105
|
+
* used by tools such as the OpenAPI Generator and Smart Coercion plugins.
|
|
106
|
+
*
|
|
107
|
+
* @see {@link https://orpc.dev/docs/integrations/standard-schema | Standard Schema Integration}
|
|
108
|
+
*/
|
|
93
109
|
interface JsonSchemaConverter {
|
|
94
110
|
/**
|
|
95
111
|
* Determines whether this converter can handle the given schema.
|
|
@@ -153,6 +169,12 @@ declare function resolveJsonSchemaRootLocalRef(schema: JsonSchema, $defs?: Exclu
|
|
|
153
169
|
interface SmartCoercionHandlerPluginOptions {
|
|
154
170
|
converters?: undefined | JsonSchemaConverter[];
|
|
155
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Coerces incoming request data to match the expected `.input` schema types before validation,
|
|
174
|
+
* based on JSON schemas produced by the configured converters.
|
|
175
|
+
*
|
|
176
|
+
* @see {@link https://orpc.dev/docs/plugins/smart-coercion | Smart Coercion Plugin}
|
|
177
|
+
*/
|
|
156
178
|
declare class SmartCoercionHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
157
179
|
name: string;
|
|
158
180
|
private readonly converter;
|
|
@@ -166,6 +188,12 @@ declare class SmartCoercionHandlerPlugin<T extends Context> implements StandardH
|
|
|
166
188
|
interface SmartCoercionLinkPluginOptions {
|
|
167
189
|
converters?: undefined | JsonSchemaConverter[];
|
|
168
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Coerces server responses to match the expected `.output` or `.errors` schema types before validation,
|
|
193
|
+
* based on JSON schemas produced by the configured converters.
|
|
194
|
+
*
|
|
195
|
+
* @see {@link https://orpc.dev/docs/plugins/smart-coercion | Smart Coercion Plugin}
|
|
196
|
+
*/
|
|
169
197
|
declare class SmartCoercionLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
170
198
|
private readonly contract;
|
|
171
199
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ import { ClientContext } from '@orpc/client';
|
|
|
8
8
|
import { StandardLinkPlugin, StandardLinkOptions } from '@orpc/client/standard';
|
|
9
9
|
import { StandardJSONSchemaV1 } from '@standard-schema/spec';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* A JSON Schema (draft 2020-12) representation used across oRPC's JSON schema tooling.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://orpc.dev/docs/integrations/standard-schema | Standard Schema Integration}
|
|
15
|
+
*/
|
|
11
16
|
type JsonSchema<Value = any> = Draft2020.JSONSchema<Value>;
|
|
12
17
|
type JsonSchemaKeywords = typeof Draft2020.keywords[number];
|
|
13
18
|
declare enum JsonSchemaXNativeType {
|
|
@@ -89,7 +94,18 @@ declare function flattenJsonUnionSchema(schema: JsonSchema): JsonSchema[];
|
|
|
89
94
|
declare function matchArrayableJsonSchema(schema: JsonSchema): undefined | [itemSchema: JsonSchema, arraySchema: JsonArraySchema];
|
|
90
95
|
declare function deduplicateJsonSchemas(schemas: JsonSchema[]): JsonSchema[];
|
|
91
96
|
|
|
97
|
+
/**
|
|
98
|
+
* The conversion direction: `input` targets the schema's input type, `output` targets its output type.
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://orpc.dev/docs/integrations/standard-schema | Standard Schema Integration}
|
|
101
|
+
*/
|
|
92
102
|
type JsonSchemaConverterDirection = 'input' | 'output';
|
|
103
|
+
/**
|
|
104
|
+
* Interface for converting validation schemas into JSON Schema representations,
|
|
105
|
+
* used by tools such as the OpenAPI Generator and Smart Coercion plugins.
|
|
106
|
+
*
|
|
107
|
+
* @see {@link https://orpc.dev/docs/integrations/standard-schema | Standard Schema Integration}
|
|
108
|
+
*/
|
|
93
109
|
interface JsonSchemaConverter {
|
|
94
110
|
/**
|
|
95
111
|
* Determines whether this converter can handle the given schema.
|
|
@@ -153,6 +169,12 @@ declare function resolveJsonSchemaRootLocalRef(schema: JsonSchema, $defs?: Exclu
|
|
|
153
169
|
interface SmartCoercionHandlerPluginOptions {
|
|
154
170
|
converters?: undefined | JsonSchemaConverter[];
|
|
155
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Coerces incoming request data to match the expected `.input` schema types before validation,
|
|
174
|
+
* based on JSON schemas produced by the configured converters.
|
|
175
|
+
*
|
|
176
|
+
* @see {@link https://orpc.dev/docs/plugins/smart-coercion | Smart Coercion Plugin}
|
|
177
|
+
*/
|
|
156
178
|
declare class SmartCoercionHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
157
179
|
name: string;
|
|
158
180
|
private readonly converter;
|
|
@@ -166,6 +188,12 @@ declare class SmartCoercionHandlerPlugin<T extends Context> implements StandardH
|
|
|
166
188
|
interface SmartCoercionLinkPluginOptions {
|
|
167
189
|
converters?: undefined | JsonSchemaConverter[];
|
|
168
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Coerces server responses to match the expected `.output` or `.errors` schema types before validation,
|
|
193
|
+
* based on JSON schemas produced by the configured converters.
|
|
194
|
+
*
|
|
195
|
+
* @see {@link https://orpc.dev/docs/plugins/smart-coercion | Smart Coercion Plugin}
|
|
196
|
+
*/
|
|
169
197
|
declare class SmartCoercionLinkPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
170
198
|
private readonly contract;
|
|
171
199
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/json-schema",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.24",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@standard-schema/spec": "^1.1.0",
|
|
29
29
|
"json-schema-typed": "^8.0.2",
|
|
30
|
-
"@orpc/
|
|
31
|
-
"@orpc/server": "2.0.0-beta.
|
|
32
|
-
"@orpc/
|
|
33
|
-
"@orpc/
|
|
30
|
+
"@orpc/contract": "2.0.0-beta.24",
|
|
31
|
+
"@orpc/server": "2.0.0-beta.24",
|
|
32
|
+
"@orpc/shared": "2.0.0-beta.24",
|
|
33
|
+
"@orpc/client": "2.0.0-beta.24"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"zod": "^4.4.3"
|