@temporary-name/json-schema 1.9.3-alpha.b7ce8fb6e9463a26fd2564cb172dc612ae4de52d → 1.9.3-alpha.c13915862ce0feb161cb37a7c0da5ab7d57bd1bf
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 -33
- 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,35 +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 { bodySchema, pathSchema, querySchema } = options2.procedure["~orpc"].schemas;
|
|
352
|
-
const coercedBody = await this.#coerce(bodySchema, options2.input.body);
|
|
353
|
-
const coercedPath = await this.#coerce(pathSchema, options2.input.path);
|
|
354
|
-
const coercedQuery = await this.#coerce(querySchema, options2.input.query);
|
|
355
|
-
return options2.next({
|
|
356
|
-
...options2,
|
|
357
|
-
input: { body: coercedBody, path: coercedPath, query: coercedQuery }
|
|
358
|
-
});
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
async #coerce(schema, value) {
|
|
362
|
-
let jsonSchema = this.cache.get(schema);
|
|
363
|
-
if (!jsonSchema) {
|
|
364
|
-
jsonSchema = (await this.converter.convert(schema, { strategy: "input" }))[1];
|
|
365
|
-
this.cache.set(schema, jsonSchema);
|
|
366
|
-
}
|
|
367
|
-
return this.coercer.coerce(jsonSchema, value);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
export { JsonSchemaXNativeType, experimental_JsonSchemaCoercer, experimental_SmartCoercionPlugin };
|
|
339
|
+
export { JsonSchemaXNativeType, experimental_JsonSchemaCoercer };
|
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.c13915862ce0feb161cb37a7c0da5ab7d57bd1bf",
|
|
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/interop": "1.9.3-alpha.
|
|
33
|
-
"@temporary-name/
|
|
34
|
-
"@temporary-name/
|
|
35
|
-
"@temporary-name/
|
|
32
|
+
"@temporary-name/interop": "1.9.3-alpha.c13915862ce0feb161cb37a7c0da5ab7d57bd1bf",
|
|
33
|
+
"@temporary-name/shared": "1.9.3-alpha.c13915862ce0feb161cb37a7c0da5ab7d57bd1bf",
|
|
34
|
+
"@temporary-name/zod": "1.9.3-alpha.c13915862ce0feb161cb37a7c0da5ab7d57bd1bf",
|
|
35
|
+
"@temporary-name/server": "1.9.3-alpha.c13915862ce0feb161cb37a7c0da5ab7d57bd1bf"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {},
|
|
38
38
|
"scripts": {
|