@temporary-name/json-schema 1.9.3-alpha.03f5d40e5b399f85012c2fb4e98167e26d551d36 → 1.9.3-alpha.0f2e1f4d66464608b85c66977bff51174cbb238f
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 +2 -17
- package/dist/index.d.ts +2 -17
- package/dist/index.mjs +1 -31
- package/dist/zod4/index.d.mts +3 -3
- package/dist/zod4/index.d.ts +3 -3
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import * as Draft07 from '@temporary-name/interop/json-schema-typed/draft-07';
|
|
2
2
|
import * as Draft2019 from '@temporary-name/interop/json-schema-typed/draft-2019-09';
|
|
3
3
|
import * as Draft2020 from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
4
|
-
import { Context } from '@temporary-name/server';
|
|
5
|
-
import { ConditionalSchemaConverter } from '@temporary-name/server/openapi';
|
|
6
|
-
import { StandardHandlerPlugin, StandardHandlerOptions } from '@temporary-name/server/standard';
|
|
7
4
|
|
|
8
5
|
type JsonSchema = Draft2020.JSONSchema | Draft2019.JSONSchema | Draft07.JSONSchema;
|
|
9
6
|
declare enum JsonSchemaXNativeType {
|
|
@@ -23,17 +20,5 @@ declare class experimental_JsonSchemaCoercer {
|
|
|
23
20
|
coerce(schema: JsonSchema, value: unknown, options?: experimental_JsonSchemaCoerceOptions): unknown;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
declare class experimental_SmartCoercionPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
30
|
-
#private;
|
|
31
|
-
private readonly converter;
|
|
32
|
-
private readonly coercer;
|
|
33
|
-
private readonly cache;
|
|
34
|
-
constructor(options?: experimental_SmartCoercionPluginOptions);
|
|
35
|
-
init(options: StandardHandlerOptions<T>): void;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { JsonSchemaXNativeType, experimental_JsonSchemaCoercer, experimental_SmartCoercionPlugin };
|
|
39
|
-
export type { JsonSchema, experimental_JsonSchemaCoerceOptions, experimental_SmartCoercionPluginOptions };
|
|
23
|
+
export { JsonSchemaXNativeType, experimental_JsonSchemaCoercer };
|
|
24
|
+
export type { JsonSchema, experimental_JsonSchemaCoerceOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import * as Draft07 from '@temporary-name/interop/json-schema-typed/draft-07';
|
|
2
2
|
import * as Draft2019 from '@temporary-name/interop/json-schema-typed/draft-2019-09';
|
|
3
3
|
import * as Draft2020 from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
4
|
-
import { Context } from '@temporary-name/server';
|
|
5
|
-
import { ConditionalSchemaConverter } from '@temporary-name/server/openapi';
|
|
6
|
-
import { StandardHandlerPlugin, StandardHandlerOptions } from '@temporary-name/server/standard';
|
|
7
4
|
|
|
8
5
|
type JsonSchema = Draft2020.JSONSchema | Draft2019.JSONSchema | Draft07.JSONSchema;
|
|
9
6
|
declare enum JsonSchemaXNativeType {
|
|
@@ -23,17 +20,5 @@ declare class experimental_JsonSchemaCoercer {
|
|
|
23
20
|
coerce(schema: JsonSchema, value: unknown, options?: experimental_JsonSchemaCoerceOptions): unknown;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
declare class experimental_SmartCoercionPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
30
|
-
#private;
|
|
31
|
-
private readonly converter;
|
|
32
|
-
private readonly coercer;
|
|
33
|
-
private readonly cache;
|
|
34
|
-
constructor(options?: experimental_SmartCoercionPluginOptions);
|
|
35
|
-
init(options: StandardHandlerOptions<T>): void;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { JsonSchemaXNativeType, experimental_JsonSchemaCoercer, experimental_SmartCoercionPlugin };
|
|
39
|
-
export type { JsonSchema, experimental_JsonSchemaCoerceOptions, experimental_SmartCoercionPluginOptions };
|
|
23
|
+
export { JsonSchemaXNativeType, experimental_JsonSchemaCoercer };
|
|
24
|
+
export type { JsonSchema, experimental_JsonSchemaCoerceOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isObject, toArray, guard } from '@temporary-name/shared';
|
|
2
|
-
import { CompositeSchemaConverter } from '@temporary-name/server/openapi';
|
|
3
2
|
|
|
4
3
|
var JsonSchemaXNativeType = /* @__PURE__ */ ((JsonSchemaXNativeType2) => {
|
|
5
4
|
JsonSchemaXNativeType2["BigInt"] = "bigint";
|
|
@@ -337,33 +336,4 @@ class experimental_JsonSchemaCoercer {
|
|
|
337
336
|
}
|
|
338
337
|
}
|
|
339
338
|
|
|
340
|
-
|
|
341
|
-
converter;
|
|
342
|
-
coercer;
|
|
343
|
-
cache = /* @__PURE__ */ new WeakMap();
|
|
344
|
-
constructor(options = {}) {
|
|
345
|
-
this.converter = new CompositeSchemaConverter(toArray(options.schemaConverters));
|
|
346
|
-
this.coercer = new experimental_JsonSchemaCoercer();
|
|
347
|
-
}
|
|
348
|
-
init(options) {
|
|
349
|
-
options.clientInterceptors ??= [];
|
|
350
|
-
options.clientInterceptors.unshift(async (options2) => {
|
|
351
|
-
const inputSchema = options2.procedure["~orpc"].inputSchema;
|
|
352
|
-
if (!inputSchema) {
|
|
353
|
-
return options2.next();
|
|
354
|
-
}
|
|
355
|
-
const coercedInput = await this.#coerce(inputSchema, options2.input);
|
|
356
|
-
return options2.next({ ...options2, input: coercedInput });
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
async #coerce(schema, value) {
|
|
360
|
-
let jsonSchema = this.cache.get(schema);
|
|
361
|
-
if (!jsonSchema) {
|
|
362
|
-
jsonSchema = (await this.converter.convert(schema, { strategy: "input" }))[1];
|
|
363
|
-
this.cache.set(schema, jsonSchema);
|
|
364
|
-
}
|
|
365
|
-
return this.coercer.coerce(jsonSchema, value);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
export { JsonSchemaXNativeType, experimental_JsonSchemaCoercer, experimental_SmartCoercionPlugin };
|
|
339
|
+
export { JsonSchemaXNativeType, experimental_JsonSchemaCoercer };
|
package/dist/zod4/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSONSchema, SchemaConvertOptions, ConditionalSchemaConverter } from '@temporary-name/server/openapi';
|
|
2
2
|
import { Interceptor } from '@temporary-name/shared';
|
|
3
|
-
import {
|
|
3
|
+
import { core } from '@temporary-name/zod';
|
|
4
4
|
import * as zod_v4_core from 'zod/v4/core';
|
|
5
5
|
import { $ZodType, $input, $output } from 'zod/v4/core';
|
|
6
6
|
|
|
@@ -58,8 +58,8 @@ declare class ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
|
|
|
58
58
|
private readonly undefinedJsonSchema;
|
|
59
59
|
private readonly interceptors;
|
|
60
60
|
constructor(options?: ZodToJsonSchemaConverterOptions);
|
|
61
|
-
condition(schema:
|
|
62
|
-
convert(schema:
|
|
61
|
+
condition(schema: core.$ZodType | undefined): boolean;
|
|
62
|
+
convert(schema: core.$ZodType | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
package/dist/zod4/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSONSchema, SchemaConvertOptions, ConditionalSchemaConverter } from '@temporary-name/server/openapi';
|
|
2
2
|
import { Interceptor } from '@temporary-name/shared';
|
|
3
|
-
import {
|
|
3
|
+
import { core } from '@temporary-name/zod';
|
|
4
4
|
import * as zod_v4_core from 'zod/v4/core';
|
|
5
5
|
import { $ZodType, $input, $output } from 'zod/v4/core';
|
|
6
6
|
|
|
@@ -58,8 +58,8 @@ declare class ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
|
|
|
58
58
|
private readonly undefinedJsonSchema;
|
|
59
59
|
private readonly interceptors;
|
|
60
60
|
constructor(options?: ZodToJsonSchemaConverterOptions);
|
|
61
|
-
condition(schema:
|
|
62
|
-
convert(schema:
|
|
61
|
+
condition(schema: core.$ZodType | undefined): boolean;
|
|
62
|
+
convert(schema: core.$ZodType | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporary-name/json-schema",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.9.3-alpha.
|
|
4
|
+
"version": "1.9.3-alpha.0f2e1f4d66464608b85c66977bff51174cbb238f",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://www.stainless.com/",
|
|
7
7
|
"repository": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"zod": "^4.1.11",
|
|
32
|
-
"@temporary-name/
|
|
33
|
-
"@temporary-name/
|
|
34
|
-
"@temporary-name/
|
|
35
|
-
"@temporary-name/
|
|
32
|
+
"@temporary-name/interop": "1.9.3-alpha.0f2e1f4d66464608b85c66977bff51174cbb238f",
|
|
33
|
+
"@temporary-name/server": "1.9.3-alpha.0f2e1f4d66464608b85c66977bff51174cbb238f",
|
|
34
|
+
"@temporary-name/zod": "1.9.3-alpha.0f2e1f4d66464608b85c66977bff51174cbb238f",
|
|
35
|
+
"@temporary-name/shared": "1.9.3-alpha.0f2e1f4d66464608b85c66977bff51174cbb238f"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {},
|
|
38
38
|
"scripts": {
|