@orpc/json-schema 1.12.3 → 1.13.0
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/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.mjs +4 -4
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -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
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/json-schema",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.13.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"json-schema-typed": "^8.0.2",
|
|
28
|
-
"@orpc/
|
|
29
|
-
"@orpc/
|
|
30
|
-
"@orpc/
|
|
31
|
-
"@orpc/server": "1.
|
|
32
|
-
"@orpc/shared": "1.
|
|
28
|
+
"@orpc/contract": "1.13.0",
|
|
29
|
+
"@orpc/openapi": "1.13.0",
|
|
30
|
+
"@orpc/interop": "1.13.0",
|
|
31
|
+
"@orpc/server": "1.13.0",
|
|
32
|
+
"@orpc/shared": "1.13.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"zod": "^4.1.12"
|