@orpc/json-schema 0.0.0-next.ee89076 → 0.0.0-next.f01f7b1
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 +5 -2
- 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>
|
|
@@ -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
|
|
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.f01f7b1",
|
|
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.f01f7b1",
|
|
29
|
+
"@orpc/interop": "0.0.0-next.f01f7b1",
|
|
30
|
+
"@orpc/openapi": "0.0.0-next.f01f7b1",
|
|
31
|
+
"@orpc/server": "0.0.0-next.f01f7b1",
|
|
32
|
+
"@orpc/shared": "0.0.0-next.f01f7b1"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"zod": "^4.1.
|
|
35
|
+
"zod": "^4.1.12"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
38
|
"build": "unbuild",
|