typedriver 0.8.8 → 0.8.9

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.
@@ -1,5 +1,5 @@
1
1
  import Type from 'typebox';
2
- import { type StandardSchemaV1, type StandardJSONSchemaV1 } from './_standard/standard-schema.mjs';
2
+ import { type StandardSchemaV1, type StandardJSONSchemaV1 } from '@standard-schema/spec';
3
3
  import { Validator } from './validator.mjs';
4
4
  type TFromStandardSchema<Input extends StandardSchemaV1, Output extends unknown = StandardSchemaV1.InferInput<Input>, Result extends Validator = Validator<Input, Output>> = Result;
5
5
  type TFromStandardJsonSchema<Input extends StandardSchemaV1 & StandardJSONSchemaV1, Output extends unknown = StandardSchemaV1.InferInput<Input>, Result extends Validator = Validator<Input, Output>> = Result;
@@ -1,4 +1,4 @@
1
- import type { StandardSchemaV1 } from '../_standard/standard-schema.mjs';
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
2
  import type { TStandardSchemaError } from '../validator.mjs';
3
3
  /** (Internal) Normalize a StandardSchemaV1.Issue as TStandardSchemaError. */
4
4
  export declare function normalIssue(issue: StandardSchemaV1.Issue): TStandardSchemaError;
@@ -1,2 +1,2 @@
1
- import { StandardSchemaV1, StandardJSONSchemaV1 } from '../_standard/standard-schema.mjs';
1
+ import { StandardSchemaV1, StandardJSONSchemaV1 } from '@standard-schema/spec';
2
2
  export declare function IsStandardJsonSchemaV1(value: unknown): value is StandardSchemaV1 & StandardJSONSchemaV1;
@@ -1,2 +1,2 @@
1
- import { StandardSchemaV1 } from '../_standard/standard-schema.mjs';
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
2
  export declare function IsStandardSchemaV1(value: unknown): value is StandardSchemaV1;
@@ -1,4 +1,4 @@
1
- import { type StandardSchemaV1 } from './_standard/standard-schema.mjs';
1
+ import { type StandardSchemaV1 } from '@standard-schema/spec';
2
2
  import { type Validator } from './validator.mjs';
3
3
  import Type from 'typebox';
4
4
  type StaticValidator<_Input extends unknown, Output extends unknown> = (Output);
@@ -1,3 +1,3 @@
1
- import { StandardJSONSchemaV1 } from '../../_standard/standard-schema.mjs';
1
+ import { StandardJSONSchemaV1 } from '@standard-schema/spec';
2
2
  /** (Internal) Resolves a JsonSchema representation (need discovery mechanism here) */
3
3
  export declare function resolveJsonSchema(input: StandardJSONSchemaV1): Record<string, unknown>;
@@ -1,4 +1,4 @@
1
- import { StandardJSONSchemaV1, StandardSchemaV1 } from '../../_standard/standard-schema.mjs';
1
+ import { StandardJSONSchemaV1, StandardSchemaV1 } from '@standard-schema/spec';
2
2
  import { Validator, type TErrorOptions, type TErrorResult } from '../../validator.mjs';
3
3
  export declare class StandardJsonSchemaValidator<Input extends StandardJSONSchemaV1 & StandardSchemaV1, Output extends unknown = StandardSchemaV1.InferOutput<Input>> extends Validator<Input, Output> {
4
4
  private readonly input;
@@ -1,4 +1,4 @@
1
- import { StandardSchemaV1 } from '../../_standard/standard-schema.mjs';
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
2
  import { Validator, type TErrorOptions, type TErrorResult } from '../../validator.mjs';
3
3
  export declare class StandardSchemaValidator<Input extends StandardSchemaV1, Output extends unknown = StandardSchemaV1.InferOutput<Input>> extends Validator<Input, Output> {
4
4
  private readonly input;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typedriver",
3
3
  "description": "High Performance Driver for Runtime Type System Integration",
4
- "version": "0.8.8",
4
+ "version": "0.8.9",
5
5
  "keywords": [
6
6
  "typescript",
7
7
  "json-schema",
@@ -14,7 +14,8 @@
14
14
  "url": "https://github.com/sinclairzx81/typedriver"
15
15
  },
16
16
  "dependencies": {
17
- "typebox": "^1.0.61"
17
+ "@standard-schema/spec": "1.1.0",
18
+ "typebox": "^1.0.64"
18
19
  },
19
20
  "type": "module",
20
21
  "types": "./build/index.d.mts",
package/readme.md CHANGED
@@ -423,7 +423,7 @@ type T = Static<typeof T> // type T = number
423
423
 
424
424
  ## Accelerate
425
425
 
426
- TypeDriver provides acceleration support for libraries that implement the upcoming Standard JSON Schema specification. This is a new specification enables remote type libraries to be integrated directly into TypeBox validation infrastructure. This project tracks upstream implementations of this specification and maintains a benchmark measuring compariative performance with and without compile(...).
426
+ TypeDriver provides acceleration support for libraries that implement the Standard JSON Schema specification.
427
427
 
428
428
  ```bash
429
429
  $ deno task bench
@@ -440,20 +440,17 @@ const Vector3 = compile(`{
440
440
  Accelerated Indicates Support for Standard JSON Schema
441
441
 
442
442
  ```bash
443
- ┌────────────┬────────────┬─────────────┬──────────────┬──────────────┬─────────────────┐
444
- │ (idx) │ iterations │ accelerated │ default(...) │ compile(...) │ result
445
- ├────────────┼────────────┼─────────────┼──────────────┼──────────────┼─────────────────┤
446
- │ typescript │ 16000000 │ true │ " ------" │ " 30 ms" │ " ------"
447
- │ jsonschema │ 16000000 │ true │ " ------" │ " 29 ms" │ " ------"
448
- arktype │ 16000000 │ true │ " 537 ms" │ " 30 ms" │ "94.41% faster" │
449
- arri │ 16000000 │ false │ " 3086 ms" │ " 3049 ms" │ "1.20% faster"
450
- effect │ 16000000 │ false │ "24183 ms" │ "23886 ms" │ "1.23% faster"
451
- │ sury │ 16000000 │ false │ " 153 ms" │ " 166 ms" │ "8.33% slower" │
452
- │ valibot │ 16000000 │ false │ " 3632 ms" │ " 3515 ms" │ "3.21% faster" │
453
- zod │ 16000000 │ false │ " 575 ms" │ " 603 ms" │ "4.93% slower" │
454
- └────────────┴────────────┴─────────────┴──────────────┴──────────────┴─────────────────┘
455
-
456
- Last Run: Thu Dec 04 2025
443
+ ┌────────────┬────────────┬─────────────┬────────────────┬───────────────┬──────────────┐
444
+ │ (idx) │ iterations │ accelerated │ standard (...) │ compile (...) │ performance
445
+ ├────────────┼────────────┼─────────────┼────────────────┼───────────────┼──────────────┤
446
+ │ typescript │ 16000000 │ true │ " 30 ms" │ " 29 ms" │ " 1.02 ×"
447
+ │ jsonschema │ 16000000 │ true │ " 29 ms" │ " 29 ms" │ " 1.00 ×"
448
+ zod │ 16000000 │ true │ " 571 ms" │ " 28 ms" │ " 20.43 ×" │
449
+ arktype │ 16000000 │ true │ " 483 ms" │ " 30 ms" │ " 16.10 ×"
450
+ valibot │ 16000000 │ true │ " 3239 ms" │ " 28 ms" │ " 113.72 ×"
451
+ └────────────┴────────────┴─────────────┴────────────────┴───────────────┴──────────────┘
452
+
453
+ Last Run: Sat Dec 20 2025
457
454
  ```
458
455
 
459
456
  ## Compression
@@ -1,120 +0,0 @@
1
- /** The Standard Typed interface. This is a base type extended by other specs. */
2
- export interface StandardTypedV1<Input = unknown, Output = Input> {
3
- /** The Standard properties. */
4
- readonly '~standard': StandardTypedV1.Props<Input, Output>;
5
- }
6
- export declare namespace StandardTypedV1 {
7
- /** The Standard Typed properties interface. */
8
- export interface Props<Input = unknown, Output = Input> {
9
- /** The version number of the standard. */
10
- readonly version: 1;
11
- /** The vendor name of the schema library. */
12
- readonly vendor: string;
13
- /** Inferred types associated with the schema. */
14
- readonly types?: Types<Input, Output> | undefined;
15
- }
16
- /** The Standard Typed types interface. */
17
- export interface Types<Input = unknown, Output = Input> {
18
- /** The input type of the schema. */
19
- readonly input: Input;
20
- /** The output type of the schema. */
21
- readonly output: Output;
22
- }
23
- /** Infers the input type of a Standard Typed. */
24
- export type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema['~standard']['types']>['input'];
25
- /** Infers the output type of a Standard Typed. */
26
- export type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema['~standard']['types']>['output'];
27
- export {};
28
- }
29
- /** The Standard Schema interface. */
30
- export interface StandardSchemaV1<Input = unknown, Output = Input> {
31
- /** The Standard Schema properties. */
32
- readonly '~standard': StandardSchemaV1.Props<Input, Output>;
33
- }
34
- export declare namespace StandardSchemaV1 {
35
- /** The Standard Schema properties interface. */
36
- export interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
37
- /** Validates unknown input values. */
38
- readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
39
- }
40
- /** The result interface of the validate function. */
41
- export type Result<Output> = SuccessResult<Output> | FailureResult;
42
- /** The result interface if validation succeeds. */
43
- export interface SuccessResult<Output> {
44
- /** The typed output value. */
45
- readonly value: Output;
46
- /** A falsy value for `issues` indicates success. */
47
- readonly issues?: undefined;
48
- }
49
- export interface Options {
50
- /** Explicit support for additional vendor-specific parameters, if needed. */
51
- readonly libraryOptions?: Record<string, unknown> | undefined;
52
- }
53
- /** The result interface if validation fails. */
54
- export interface FailureResult {
55
- /** The issues of failed validation. */
56
- readonly issues: ReadonlyArray<Issue>;
57
- }
58
- /** The issue interface of the failure output. */
59
- export interface Issue {
60
- /** The error message of the issue. */
61
- readonly message: string;
62
- /** The path of the issue, if any. */
63
- readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
64
- }
65
- /** The path segment interface of the issue. */
66
- export interface PathSegment {
67
- /** The key representing a path segment. */
68
- readonly key: PropertyKey;
69
- }
70
- /** The Standard types interface. */
71
- export interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
72
- }
73
- /** Infers the input type of a Standard. */
74
- export type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
75
- /** Infers the output type of a Standard. */
76
- export type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
77
- export {};
78
- }
79
- /** The Standard JSON Schema interface. */
80
- export interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
81
- /** The Standard JSON Schema properties. */
82
- readonly '~standard': StandardJSONSchemaV1.Props<Input, Output>;
83
- }
84
- export declare namespace StandardJSONSchemaV1 {
85
- /** The Standard JSON Schema properties interface. */
86
- export interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
87
- /** Methods for generating the input/output JSON Schema. */
88
- readonly jsonSchema: StandardJSONSchemaV1.Converter;
89
- }
90
- /** The Standard JSON Schema converter interface. */
91
- export interface Converter {
92
- /** Converts the input type to JSON Schema. May throw if conversion is not supported. */
93
- readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
94
- /** Converts the output type to JSON Schema. May throw if conversion is not supported. */
95
- readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
96
- }
97
- /**
98
- * The target version of the generated JSON Schema.
99
- *
100
- * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.
101
- *
102
- * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`.
103
- */
104
- export type Target = 'draft-2020-12' | 'draft-07' | 'openapi-3.0' | ({} & string);
105
- /** The options for the input/output methods. */
106
- export interface Options {
107
- /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */
108
- readonly target: Target;
109
- /** Explicit support for additional vendor-specific parameters, if needed. */
110
- readonly libraryOptions?: Record<string, unknown> | undefined;
111
- }
112
- /** The Standard types interface. */
113
- export interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
114
- }
115
- /** Infers the input type of a Standard. */
116
- export type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
117
- /** Infers the output type of a Standard. */
118
- export type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
119
- export {};
120
- }
@@ -1 +0,0 @@
1
- export {};