@orpc/json-schema 0.0.0-next.a320605 → 0.0.0-next.a464abe
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 +7 -3
- package/dist/index.d.mts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.mjs +4 -4
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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>
|
|
@@ -17,6 +17,9 @@
|
|
|
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/unnoq/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.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as Draft07 from '
|
|
2
|
-
import * as Draft2019 from '
|
|
3
|
-
import * as Draft2020 from '
|
|
1
|
+
import * as Draft07 from 'json-schema-typed/draft-07';
|
|
2
|
+
import * as Draft2019 from 'json-schema-typed/draft-2019-09';
|
|
3
|
+
import * as Draft2020 from 'json-schema-typed/draft-2020-12';
|
|
4
4
|
import { ConditionalSchemaConverter } from '@orpc/openapi';
|
|
5
5
|
import { Context } from '@orpc/server';
|
|
6
6
|
import { StandardHandlerPlugin, StandardHandlerOptions } from '@orpc/server/standard';
|
|
@@ -15,25 +15,25 @@ declare enum JsonSchemaXNativeType {
|
|
|
15
15
|
Map = "map"
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
interface
|
|
18
|
+
interface JsonSchemaCoerceOptions {
|
|
19
19
|
components?: Record<string, JsonSchema>;
|
|
20
20
|
}
|
|
21
|
-
declare class
|
|
21
|
+
declare class JsonSchemaCoercer {
|
|
22
22
|
#private;
|
|
23
|
-
coerce(schema: JsonSchema, value: unknown, options?:
|
|
23
|
+
coerce(schema: JsonSchema, value: unknown, options?: JsonSchemaCoerceOptions): unknown;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
interface
|
|
26
|
+
interface SmartCoercionPluginOptions {
|
|
27
27
|
schemaConverters?: readonly ConditionalSchemaConverter[];
|
|
28
28
|
}
|
|
29
|
-
declare class
|
|
29
|
+
declare class SmartCoercionPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
30
30
|
#private;
|
|
31
31
|
private readonly converter;
|
|
32
32
|
private readonly coercer;
|
|
33
33
|
private readonly cache;
|
|
34
|
-
constructor(options?:
|
|
34
|
+
constructor(options?: SmartCoercionPluginOptions);
|
|
35
35
|
init(options: StandardHandlerOptions<T>): void;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export {
|
|
39
|
-
export type { JsonSchema,
|
|
38
|
+
export { JsonSchemaCoercer, JsonSchemaXNativeType, SmartCoercionPlugin };
|
|
39
|
+
export type { JsonSchema, JsonSchemaCoerceOptions, SmartCoercionPluginOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as Draft07 from '
|
|
2
|
-
import * as Draft2019 from '
|
|
3
|
-
import * as Draft2020 from '
|
|
1
|
+
import * as Draft07 from 'json-schema-typed/draft-07';
|
|
2
|
+
import * as Draft2019 from 'json-schema-typed/draft-2019-09';
|
|
3
|
+
import * as Draft2020 from 'json-schema-typed/draft-2020-12';
|
|
4
4
|
import { ConditionalSchemaConverter } from '@orpc/openapi';
|
|
5
5
|
import { Context } from '@orpc/server';
|
|
6
6
|
import { StandardHandlerPlugin, StandardHandlerOptions } from '@orpc/server/standard';
|
|
@@ -15,25 +15,25 @@ declare enum JsonSchemaXNativeType {
|
|
|
15
15
|
Map = "map"
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
interface
|
|
18
|
+
interface JsonSchemaCoerceOptions {
|
|
19
19
|
components?: Record<string, JsonSchema>;
|
|
20
20
|
}
|
|
21
|
-
declare class
|
|
21
|
+
declare class JsonSchemaCoercer {
|
|
22
22
|
#private;
|
|
23
|
-
coerce(schema: JsonSchema, value: unknown, options?:
|
|
23
|
+
coerce(schema: JsonSchema, value: unknown, options?: JsonSchemaCoerceOptions): unknown;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
interface
|
|
26
|
+
interface SmartCoercionPluginOptions {
|
|
27
27
|
schemaConverters?: readonly ConditionalSchemaConverter[];
|
|
28
28
|
}
|
|
29
|
-
declare class
|
|
29
|
+
declare class SmartCoercionPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
30
30
|
#private;
|
|
31
31
|
private readonly converter;
|
|
32
32
|
private readonly coercer;
|
|
33
33
|
private readonly cache;
|
|
34
|
-
constructor(options?:
|
|
34
|
+
constructor(options?: SmartCoercionPluginOptions);
|
|
35
35
|
init(options: StandardHandlerOptions<T>): void;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export {
|
|
39
|
-
export type { JsonSchema,
|
|
38
|
+
export { JsonSchemaCoercer, JsonSchemaXNativeType, SmartCoercionPlugin };
|
|
39
|
+
export type { JsonSchema, JsonSchemaCoerceOptions, SmartCoercionPluginOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ var JsonSchemaXNativeType = /* @__PURE__ */ ((JsonSchemaXNativeType2) => {
|
|
|
12
12
|
})(JsonSchemaXNativeType || {});
|
|
13
13
|
|
|
14
14
|
const FLEXIBLE_DATE_FORMAT_REGEX = /^[^-]+-[^-]+-[^-]+$/;
|
|
15
|
-
class
|
|
15
|
+
class JsonSchemaCoercer {
|
|
16
16
|
coerce(schema, value, options = {}) {
|
|
17
17
|
const [, coerced] = this.#coerce(schema, value, options);
|
|
18
18
|
return coerced;
|
|
@@ -331,13 +331,13 @@ class experimental_JsonSchemaCoercer {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
class
|
|
334
|
+
class SmartCoercionPlugin {
|
|
335
335
|
converter;
|
|
336
336
|
coercer;
|
|
337
337
|
cache = /* @__PURE__ */ new WeakMap();
|
|
338
338
|
constructor(options = {}) {
|
|
339
339
|
this.converter = new CompositeSchemaConverter(toArray(options.schemaConverters));
|
|
340
|
-
this.coercer = new
|
|
340
|
+
this.coercer = new JsonSchemaCoercer();
|
|
341
341
|
}
|
|
342
342
|
init(options) {
|
|
343
343
|
options.clientInterceptors ??= [];
|
|
@@ -360,4 +360,4 @@ class experimental_SmartCoercionPlugin {
|
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
export {
|
|
363
|
+
export { JsonSchemaCoercer, JsonSchemaXNativeType, SmartCoercionPlugin };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/json-schema",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.a464abe",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://orpc.
|
|
6
|
+
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/unnoq/orpc.git",
|
|
@@ -24,14 +24,15 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
"@orpc/
|
|
29
|
-
"@orpc/
|
|
30
|
-
"@orpc/
|
|
31
|
-
"@orpc/
|
|
27
|
+
"json-schema-typed": "^8.0.2",
|
|
28
|
+
"@orpc/contract": "0.0.0-next.a464abe",
|
|
29
|
+
"@orpc/openapi": "0.0.0-next.a464abe",
|
|
30
|
+
"@orpc/shared": "0.0.0-next.a464abe",
|
|
31
|
+
"@orpc/server": "0.0.0-next.a464abe",
|
|
32
|
+
"@orpc/interop": "0.0.0-next.a464abe"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"zod": "^4.
|
|
35
|
+
"zod": "^4.2.1"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
38
|
"build": "unbuild",
|