typedriver 0.8.6 → 0.8.8

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,3 +1,3 @@
1
- import { StandardSchemaV1 } from '../_standard/standard-schema.mjs';
2
- import { TLocalizedValidationError } from 'typebox/error';
3
- export declare function errorToIssue(error: TLocalizedValidationError): StandardSchemaV1.Issue;
1
+ import type { TJsonSchemaError, TStandardSchemaError } from '../validator.mjs';
2
+ /** (Internal) Transform TJsonSchemaError to TStandardSchemaError */
3
+ export declare function errorToIssue(error: TJsonSchemaError): TStandardSchemaError;
@@ -8,6 +8,7 @@ function pathSegments(pointer) {
8
8
  return [];
9
9
  return pointer.slice(1).split('/').map((segment) => segment.replace(/~1/g, '/').replace(/~0/g, '~'));
10
10
  }
11
+ /** (Internal) Transform TJsonSchemaError to TStandardSchemaError */
11
12
  export function errorToIssue(error) {
12
13
  const path = pathSegments(error.instancePath);
13
14
  return { path, message: error.message };
@@ -1,4 +1,7 @@
1
1
  // deno-fmt-ignore-file
2
+ // ------------------------------------------------------------------
3
+ // ParseError
4
+ // ------------------------------------------------------------------
2
5
  export class ParseError extends globalThis.Error {
3
6
  constructor(value, errors) {
4
7
  super('ParseError');
@@ -12,6 +15,9 @@ export class ParseError extends globalThis.Error {
12
15
  });
13
16
  }
14
17
  }
18
+ // ------------------------------------------------------------------
19
+ // UnknownError
20
+ // ------------------------------------------------------------------
15
21
  export class UnknownError extends globalThis.Error {
16
22
  constructor(message) {
17
23
  super(`UnknownError: ${message}`);
@@ -1,3 +1,5 @@
1
1
  export * from './exceptions.mjs';
2
2
  export * from './error-to-issue.mjs';
3
3
  export * from './issue-to-error.mjs';
4
+ export * from './normal-error.mjs';
5
+ export * from './normal-issue.mjs';
@@ -2,3 +2,5 @@
2
2
  export * from './exceptions.mjs';
3
3
  export * from './error-to-issue.mjs';
4
4
  export * from './issue-to-error.mjs';
5
+ export * from './normal-error.mjs';
6
+ export * from './normal-issue.mjs';
@@ -1,3 +1,3 @@
1
- import { StandardSchemaV1 } from '../_standard/standard-schema.mjs';
2
- import { TLocalizedValidationError } from 'typebox/error';
3
- export declare function issueToError(issue: StandardSchemaV1.Issue): TLocalizedValidationError;
1
+ import type { TStandardSchemaError, TJsonSchemaError } from '../validator.mjs';
2
+ /** (Internal) Transform TStandardSchemaError to TJsonSchemaError */
3
+ export declare function issueToError(issue: TStandardSchemaError): TJsonSchemaError;
@@ -1,15 +1,23 @@
1
1
  // deno-fmt-ignore-file
2
- import { Guard } from 'typebox/guard';
3
2
  // ------------------------------------------------------------------
4
- // Issues
3
+ // Escape
5
4
  // ------------------------------------------------------------------
6
- function jsonPointer(segments) {
7
- return `#${segments.join('/')}`;
5
+ function escapeKey(segment) {
6
+ return `${segment}`.replace(/~/g, '~0').replace(/\//g, '~1');
8
7
  }
8
+ // ------------------------------------------------------------------
9
+ // Json Pointer
10
+ // ------------------------------------------------------------------
11
+ function pathToJsonPointer(path) {
12
+ const keys = path.map(escapeKey);
13
+ return `#/${keys.join('/')}`;
14
+ }
15
+ // ------------------------------------------------------------------
16
+ // IssueToError
17
+ // ------------------------------------------------------------------
18
+ /** (Internal) Transform TStandardSchemaError to TJsonSchemaError */
9
19
  export function issueToError(issue) {
10
- const instancePath = Guard.HasPropertyKey(issue, 'path') && Guard.IsArray(issue.path)
11
- ? jsonPointer(issue.path)
12
- : jsonPointer([]);
20
+ const instancePath = pathToJsonPointer(issue.path);
13
21
  return {
14
22
  instancePath,
15
23
  schemaPath: '#',
@@ -0,0 +1,4 @@
1
+ import type { TLocalizedValidationError } from 'typebox/error';
2
+ import type { TJsonSchemaError } from '../validator.mjs';
3
+ /** (Internal) Normalize a TLocalizedValidationError as TJsonSchemaError. */
4
+ export declare function normalError(error: TLocalizedValidationError): TJsonSchemaError;
@@ -0,0 +1,5 @@
1
+ // deno-fmt-ignore-file
2
+ /** (Internal) Normalize a TLocalizedValidationError as TJsonSchemaError. */
3
+ export function normalError(error) {
4
+ return error;
5
+ }
@@ -0,0 +1,4 @@
1
+ import type { StandardSchemaV1 } from '../_standard/standard-schema.mjs';
2
+ import type { TStandardSchemaError } from '../validator.mjs';
3
+ /** (Internal) Normalize a StandardSchemaV1.Issue as TStandardSchemaError. */
4
+ export declare function normalIssue(issue: StandardSchemaV1.Issue): TStandardSchemaError;
@@ -0,0 +1,30 @@
1
+ // deno-fmt-ignore-file
2
+ import { Guard } from 'typebox/guard';
3
+ // ------------------------------------------------------------------
4
+ // Normal: Segments
5
+ // ------------------------------------------------------------------
6
+ function isSegmentObjectWithKey(segment) {
7
+ return Guard.IsObject(segment) && Guard.HasPropertyKey(segment, 'key') && (Guard.IsBigInt(segment.key)
8
+ || Guard.IsBoolean(segment.key)
9
+ || Guard.IsString(segment.key)
10
+ || Guard.IsNumber(segment.key));
11
+ }
12
+ function normalizeSegment(segment) {
13
+ return isSegmentObjectWithKey(segment) ? `${segment.key}` : `${segment}`;
14
+ }
15
+ function normalizeSegments(segments) {
16
+ return segments.map(normalizeSegment);
17
+ }
18
+ // ------------------------------------------------------------------
19
+ // Resolve
20
+ // ------------------------------------------------------------------
21
+ function resolveSegments(issue) {
22
+ return (Guard.HasPropertyKey(issue, 'path') && Guard.IsArray(issue.path)
23
+ ? issue.path
24
+ : []);
25
+ }
26
+ /** (Internal) Normalize a StandardSchemaV1.Issue as TStandardSchemaError. */
27
+ export function normalIssue(issue) {
28
+ const segments = resolveSegments(issue);
29
+ return ({ path: normalizeSegments(segments), message: issue.message });
30
+ }
package/build/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
1
  export { type TCompile, compile } from './compile.mjs';
2
2
  export { type Static } from './static.mjs';
3
- export { Validator, type TErrorFormat, type TErrorLocale, type TErrorOptions, type TErrorResult } from './validator.mjs';
3
+ export { Validator, type TErrorFormat, type TErrorLocale, type TErrorOptions, type TErrorResult, type TJsonSchemaError, type TStandardSchemaError, } from './validator.mjs';
4
+ import { compile } from './compile.mjs';
5
+ export default compile;
package/build/index.mjs CHANGED
@@ -6,4 +6,9 @@ export { compile } from './compile.mjs';
6
6
  // ------------------------------------------------------------------
7
7
  // Validator
8
8
  // ------------------------------------------------------------------
9
- export { Validator } from './validator.mjs';
9
+ export { Validator, } from './validator.mjs';
10
+ // ------------------------------------------------------------------
11
+ // Default
12
+ // ------------------------------------------------------------------
13
+ import { compile } from './compile.mjs';
14
+ export default compile;
@@ -1,33 +1,27 @@
1
1
  import { System } from 'typebox/system';
2
- import { TLocalizedValidationError } from 'typebox/error';
3
- import { StandardSchemaV1 } from './_standard/standard-schema.mjs';
4
2
  export type TErrorFormat = 'json-schema' | 'standard-schema';
3
+ export interface TJsonSchemaError {
4
+ keyword: string;
5
+ schemaPath: string;
6
+ instancePath: string;
7
+ params: object;
8
+ message: string;
9
+ }
10
+ export interface TStandardSchemaError {
11
+ path: string[];
12
+ message: string;
13
+ }
5
14
  declare const Locale: typeof System.Locale;
6
15
  export type TErrorLocale = (Exclude<keyof typeof Locale, 'Get' | 'Set' | 'Reset'> & ({} & string));
7
16
  /** Internal */
8
17
  export declare function resolveErrorOptions(options?: Partial<TErrorOptions>): TErrorOptions;
9
18
  export interface TErrorOptions {
10
- /**
11
- * Specifies the error message generation format.
12
- *
13
- * Supported values are `json-schema` and `standard-schema`.
14
- *
15
- * Default: `json-schema`
16
- */
19
+ /** Specifies the error format. Default: `json-schema` */
17
20
  format: TErrorFormat;
18
- /**
19
- * Specifies the locale used when generating error messages.
20
- *
21
- * This setting applies only when used with TypeScript, JSON Schema,
22
- * or implementations that follow the Standard JSON Schema specification.
23
- * When the compiled type is Standard Schema only, the error message
24
- * will be whatever is returned from that library.
25
- *
26
- * Default: `en_US`
27
- */
21
+ /** Specifies the error format. Default: `en_US` */
28
22
  locale: TErrorLocale;
29
23
  }
30
- export type TErrorResult<Options extends Partial<TErrorOptions>> = (Options['format'] extends 'standard-schema' ? StandardSchemaV1.Issue[] : TLocalizedValidationError[]);
24
+ export type TErrorResult<Options extends Partial<TErrorOptions>> = (Options['format'] extends 'standard-schema' ? TStandardSchemaError[] : TJsonSchemaError[]);
31
25
  /** Abstract Base for all Validator types. */
32
26
  export declare abstract class Validator<Input extends unknown = unknown, Output extends unknown = unknown> {
33
27
  /** Returns the schema used to construct this validator */
@@ -1,7 +1,7 @@
1
1
  // deno-fmt-ignore-file
2
2
  import { System } from 'typebox/system';
3
3
  import { Validator as TBValidator } from 'typebox/compile';
4
- import { ParseError, errorToIssue } from '../../errors/index.mjs';
4
+ import { ParseError, errorToIssue, normalError } from '../../errors/index.mjs';
5
5
  import { Validator, resolveErrorOptions } from '../../validator.mjs';
6
6
  export class JsonSchemaValidator extends Validator {
7
7
  constructor(input) {
@@ -46,7 +46,7 @@ export class JsonSchemaValidator extends Validator {
46
46
  System.Locale.Set(System.Locale[config.locale]);
47
47
  const errors = this.validator.Errors(value);
48
48
  return (config.format === 'standard-schema'
49
- ? errors.map(error => errorToIssue(error))
50
- : errors);
49
+ ? errors.map(error => errorToIssue(normalError(error)))
50
+ : errors.map(error => normalError(error)));
51
51
  }
52
52
  }
@@ -1,2 +1,3 @@
1
1
  import { StandardJSONSchemaV1 } from '../../_standard/standard-schema.mjs';
2
- export declare function ResolveJsonSchema(input: StandardJSONSchemaV1): Record<string, unknown>;
2
+ /** (Internal) Resolves a JsonSchema representation (need discovery mechanism here) */
3
+ export declare function resolveJsonSchema(input: StandardJSONSchemaV1): Record<string, unknown>;
@@ -1,6 +1,6 @@
1
1
  // deno-fmt-ignore-file
2
2
  import { Guard } from 'typebox/guard';
3
- function AsOpenAPI3_0(input) {
3
+ function OpenAPI3_0(input) {
4
4
  try {
5
5
  return input['~standard'].jsonSchema.input({ target: 'openapi-3.0' });
6
6
  }
@@ -8,7 +8,7 @@ function AsOpenAPI3_0(input) {
8
8
  return undefined;
9
9
  }
10
10
  }
11
- function AsDraft7(input) {
11
+ function Draft7(input) {
12
12
  try {
13
13
  return input['~standard'].jsonSchema.input({ target: 'draft-07' });
14
14
  }
@@ -16,7 +16,7 @@ function AsDraft7(input) {
16
16
  return undefined;
17
17
  }
18
18
  }
19
- function AsDraft2020_12(input) {
19
+ function Draft2020_12(input) {
20
20
  try {
21
21
  return input['~standard'].jsonSchema.input({ target: 'draft-2020-12' });
22
22
  }
@@ -24,9 +24,9 @@ function AsDraft2020_12(input) {
24
24
  return undefined;
25
25
  }
26
26
  }
27
- // Standard JSON Schema should provide mechanism to query supported specifications
28
- export function ResolveJsonSchema(input) {
29
- const jsonschema = AsDraft2020_12(input) ?? AsDraft7(input) ?? AsOpenAPI3_0(input);
27
+ /** (Internal) Resolves a JsonSchema representation (need discovery mechanism here) */
28
+ export function resolveJsonSchema(input) {
29
+ const jsonschema = Draft2020_12(input) ?? Draft7(input) ?? OpenAPI3_0(input);
30
30
  if (Guard.IsUndefined(jsonschema))
31
31
  throw Error(`Vendor '${input['~standard'].vendor}' advertised itself as a Standard JSON Schema but failed to produce a schematic. Submit an issue with the vendor.`);
32
32
  return jsonschema;
@@ -1,14 +1,14 @@
1
1
  // deno-fmt-ignore-file
2
2
  import { System } from 'typebox/system';
3
3
  import { Validator, resolveErrorOptions } from '../../validator.mjs';
4
- import { ParseError, errorToIssue } from '../../errors/index.mjs';
4
+ import { ParseError, errorToIssue, normalError } from '../../errors/index.mjs';
5
5
  import { Validator as TBValidator } from 'typebox/compile';
6
- import { ResolveJsonSchema } from './resolve.mjs';
6
+ import { resolveJsonSchema } from './resolve.mjs';
7
7
  export class StandardJsonSchemaValidator extends Validator {
8
8
  constructor(input) {
9
9
  super();
10
10
  this.input = input;
11
- const schema = ResolveJsonSchema(input);
11
+ const schema = resolveJsonSchema(input);
12
12
  this.validator = new TBValidator({}, schema);
13
13
  }
14
14
  // ----------------------------------------------------------------
@@ -48,7 +48,7 @@ export class StandardJsonSchemaValidator extends Validator {
48
48
  System.Locale.Set(System.Locale[config.locale]);
49
49
  const errors = this.validator.Errors(value);
50
50
  return (config.format === 'standard-schema'
51
- ? errors.map(error => errorToIssue(error))
52
- : errors);
51
+ ? errors.map(error => errorToIssue(normalError(error)))
52
+ : errors.map(error => normalError(error)));
53
53
  }
54
54
  }
@@ -1,5 +1,5 @@
1
1
  // deno-fmt-ignore-file
2
- import { ParseError, UnknownError, issueToError } from '../../errors/index.mjs';
2
+ import { ParseError, UnknownError, issueToError, normalIssue } from '../../errors/index.mjs';
3
3
  import { Validator, resolveErrorOptions } from '../../validator.mjs';
4
4
  export class StandardSchemaValidator extends Validator {
5
5
  constructor(input) {
@@ -47,7 +47,7 @@ export class StandardSchemaValidator extends Validator {
47
47
  const issues = (('issues' in result) ? result.issues : []);
48
48
  const config = resolveErrorOptions(options);
49
49
  return (config.format === 'json-schema'
50
- ? issues.map(issue => issueToError(issue))
51
- : issues.map(issue => ({ path: issue.path, message: issue.message })));
50
+ ? issues.map(issue => issueToError(normalIssue(issue)))
51
+ : issues.map(issue => normalIssue(issue)));
52
52
  }
53
53
  }
@@ -1,5 +1,5 @@
1
- import { Validator, type TErrorOptions, type TErrorResult } from '../../validator.mjs';
2
1
  import Type from 'typebox';
2
+ import { Validator, type TErrorOptions, type TErrorResult } from '../../validator.mjs';
3
3
  export declare class TypeScriptValidator<Input extends string, Schema extends Type.TSchema = Type.TScript<{}, Input>, Output extends unknown = Type.Static<Schema>> extends Validator<Input, Output> {
4
4
  private readonly validator;
5
5
  private readonly script;
@@ -1,9 +1,9 @@
1
1
  // deno-fmt-ignore-file
2
+ import Type from 'typebox';
2
3
  import { System } from 'typebox/system';
3
4
  import { Validator as TBValidator } from 'typebox/compile';
4
- import { ParseError, errorToIssue } from '../../errors/index.mjs';
5
+ import { ParseError, errorToIssue, normalError } from '../../errors/index.mjs';
5
6
  import { Validator, resolveErrorOptions } from '../../validator.mjs';
6
- import Type from 'typebox';
7
7
  export class TypeScriptValidator extends Validator {
8
8
  constructor(script) {
9
9
  super();
@@ -48,7 +48,7 @@ export class TypeScriptValidator extends Validator {
48
48
  System.Locale.Set(System.Locale[config.locale]);
49
49
  const errors = this.validator.Errors(value);
50
50
  return (config.format === 'standard-schema'
51
- ? errors.map(error => errorToIssue(error))
52
- : errors);
51
+ ? errors.map(error => errorToIssue(normalError(error)))
52
+ : errors.map(error => normalError(error)));
53
53
  }
54
54
  }
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.6",
4
+ "version": "0.8.8",
5
5
  "keywords": [
6
6
  "typescript",
7
7
  "json-schema",
package/readme.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <h1>TypeDriver</h1>
4
4
 
5
- <p>High Performance Driver for Runtime Type System Integration</p>
5
+ <p>A High Performance Driver for Runtime Type System Integration</p>
6
6
 
7
7
  <img src="typedriver.png" />
8
8
 
@@ -26,7 +26,7 @@ $ npm install typedriver
26
26
  Multi-Library Type Compiler and Inference System for High Performance Frameworks
27
27
 
28
28
  ```typescript
29
- import { compile } from 'typedriver'
29
+ import compile from 'typedriver'
30
30
 
31
31
  const Vector3 = compile(`{
32
32
  x: number,
@@ -34,8 +34,6 @@ const Vector3 = compile(`{
34
34
  z: number
35
35
  }`)
36
36
 
37
- declare const value: unknown
38
-
39
37
  const position = Vector3.parse(value) // const position: {
40
38
  // x: number,
41
39
  // y: number,
@@ -43,38 +41,16 @@ const position = Vector3.parse(value) // const position: {
43
41
  // } = ...
44
42
  ```
45
43
 
46
- Supports: [TypeScript](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoAqBPADgUwMoDGATgJbYAuqYStd9D4ypAttgPbEWgDeoh7NqQA2uUAF9QAM2KDQAcgo5cAEzIA3XMXnJkAgHYBnbgDVchCpwDMoALz9B2EbgAUAAx7JQoAB4AuUH0AVxYAIy0AGi9QTADgsMjogC84kPDiZHE3AEpdFXNhAENiMQNjUHVC4SDcAKD9AGt9dgB3fV0y7g5DUgpSdn07UDMLawA6bGLDV0rq3GzvRaXFtE7Qbt7+-QDPZb39g8OjpbRvf0C0xOPrm5vTmNSE4ijb17eTsG8Ui6fo9--rmhJPYxqCgA) | [JSON Schema](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoBSBnA9gO1AMoDGAFgKYC2AhqmEvQ40+MgJYUAO2ATgC6gBvUEWydWAGzKgAvqABm3UaADkvAJ4cyAE26sAbmW7LkyEbkz8AamSK8eAZlABeYaI4SyACgHJQodZoAXCrYAEYAVja8ygA0vqDcZACOAK6siVrBANrKAB6xKmoFygBeygC6cX4cipp8rGSYwT5+frnN-hpkwcq4KRShhsoyVa1qHQHdKn0DQyPxfiUTXT0zg0Yy8dLI0gCUJlo24lSJrub8elTiKVMpuADWuNgA7rgmZhagXJisvKx4zlA1lsDgAdBwTpgvJdrmRdq0EYi0B9+N9fv9cM0Foicbi8fiCaA0G1gmtDKNCZSqYTiaBxqAydwKdSWayiWBFqT+utsWy+QS0LIXKCRUA) | [TypeBox](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoBSBnA9gO1AMoDGAFgKYC2AhgFygAqAngA5kBC2AHqmEn-wMHhkASwrNsAJwAuoAN6gi2cSIA2ZUAF9QAM0nLQAcmksyAE0kiAbmUmHR4qbKatd+ikZOsARl0OgA5GQlXExZADUyImkpAGZQAF5FZWY1MgAKFzIAOgB5bwArKOl0uWQAzjos7IA5AFcKb1t0gEoAGnLQRirTWoamyVaOgIAvHtY+xuaW5E0WmeQzKNUqSQ0QsNArKlU6sjo63ABrXGwAd1wgjdkJTBFpETxE0EjouOzmVcwM7d2yFoCgKBgLQ11At3uj1wdDKwLh8IRiKRQLQFTouH6tmGyJxuJxqK66MxkmxeLJ5ICBLGoAxU0knQpjPxYG0SWy7KAA) | [Effect](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFygCiAZi1WZqmEr3-wPDIAljQAOAeyKZQAb1BkJ44QBsqoAL6gWRJaADkmAJ5iq+IsIBuVIvpHipM+ekq1sm7bpoGqbDpjtkRVwAZxkANX8pAGZQAF4FJTFVKgAKF2o6ADowvEISDLdwgEZ012ysIgBXTlTZZFBQAA9GQuyAOSqaACMbABoG0CNW8uwszp7+wYAvEcyxid6iZA0ASnXkZHwOFWJ1YLDQS2wVKqpGKtwAa1wJAHdcTYOZSRDhTGEJXHjQSM4YrJiYghNLHU5UVaNKHQqFoZ6gV7vT64Rj1GHojGYrHY6FoRpEKjYfBfFRGZqMXBdJYDHG0ul0vGgAlEklk4agSmTIg0+m8vmwsD4wnE3Ck0CzDlUmyDfmy2loLQJLLKoA) | [Zod](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFygBaA9vqmEl9z7+MgEsaABxZFMoAN6gyLEQIA2VUAF9QAMyJzQAckwBPYVXxEBANypEdyQSLESAVKGwBnUAC8NWmrvdtryLK4LhIAalRkmGIAzKAAvDJywopUABTuAHQsAEYAVhGYqZLIoKAAHoyZuACuNNmWqQCUADQloPqVGTV1DS1t7p3d9URNyCqNjTb4EQrEykEhoGbYCtVUjNW4ANa4LADuuDYLEqIuApgCLLjxoOGRMRnCxC5py6tUjaVf319ox6Cnc6XXCMYo-cEQyFQ6HfNClCqgIaWVow1FotFw9qMJFEFHo-EE35gUoDRG1YZtQlU1FoNQJDIMoA) | [ArkType](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFygCCRA1gCoCeADlamEkFDhI8MgCWNbgHsimUAG9QZaVPEAbKqAC+oAGZFVoAOSYeVfEXEA3KkWPIJU2fKVneO-YZonird1QOyCq4AM7yAGpUZJiyAMygALzKqtwaVAAUARkKyKCgAB6MxrgArjQARnbGADR5oJzFZZXVdfkAXk3lVfbI2gCU-Y740erEWiHhoNbY6qVUjKW4rLjSAO64jpPyMqHimOLSuEmgUTHxAHTcxKGZM3NU-fnPL89o26C7+4e4jLmvAMBQOBIJeaHyRVAzR6bVBcPhcPBDUY0LssIRGMx+SRnSh3Ts9SxRMRYF0yQuFKAA) | [Valibot](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFygBq2ANgJYBGA9pqmEkFDhI8MnY0ADtyKZQAb1BluU9qyqgAvqABmRFaADkmAJ6Sq+IuwBuVIoeTipMuQCpQ2AM6hru-TSNrNi5eB2RlXE85JioyTBkAZlAAXiUVSTUqAAprADpuTgArWMws+WRQUAAPRjzcAFcaTjssgEoAGgrQE1rchqaWjq6AL17+5qI25E1W1sd8WNZiDQionzZ6qkZ63ABrXG4Ad1xHVblpT3ZMdm5cFOYSxNzJYk9soNZN1sqf35+0M6gC5XG64RjlP6QqHQmGw35oSo1UDjOydOHojEYhHdRgoohozGEon-MCVUbIxoTLrEmnotDaVK5JlAA) | [Arri](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFygCCRRAlqmEtz73+MjY0ADgHsimUAG9QZUSLYAbKqAC+oAGZF5oAOSYAnsKr52ANypFdgkeMkzsazdpp6AAsXZFhZYAGdKWmxrZDlcP0kANSoyTHEAZlAAXll5YSUqAApsADpRACMAKxjMTKlkUFAAD0Zc3ABXGnzLTIBKABoK0ANanIamlo6ugC9e-uaiNuRVVtbkZHwYxWIVMIjQM2xFeqpGetwAa1xRAHdcebXJMT82TDZRXGTQaNiEnOFiPyzN7apWyoBgIBaEuoGut3uuEY5SBsLh8IRiMBaEqNVA40snSR2JxOJR3UYGKIWNxpLJwLAlVG6MaEy65IZ2LQ6hSOTZQA) | [Sury](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFwYCuRAnqmEl9z7+MgEsaABwD2RTKADeoMqJECANlVABfUADMi80AHJMrYVXxEBANypFdgkeMkAqUNgDOGTdpp7nLVrtD+AwKDg-zQAFgA6AGZQAGsAIVAAChoBXFAAalAAcwAvAWEASmRkOVxnSQA1KjJMcRiAXll5YSUqJPQI50pabCSpZH8AD0ZO3CYaACNLABpB0FZRiPGp2fncpZXpojnVQuLkfBrFYhUyitAzbEUmKkYmXFjcUQB3XBLzyTFnAUwBUXSTWqtXqEWExGc7SuNyohRCQTQn1A31+-1wjAG8Kx2JxOLQw0YWzWuJJpOx+IWhIm2zmZLp9NAFI2oCJRHmDI55LA6iaET5QA) | ... and more
44
+ Compiles: [TypeScript](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoAqBPADgUwMoDGATgJbYAuqYStd9D4ypAttgPbEWgDeoh7NqQA2uUAF9QAM2KDQAcgo5cAEzIA3XMXnJkAgHYBnbgDVchCpwDMoALz9B2EbgAUAAx7JQoAB4AuUH0AVxYAIy0AGi9QTADgsMjogC84kPDiZHE3AEpdFXNhAENiMQNjUHVC4SDcAKD9AGt9dgB3fV0y7g5DUgpSdn07UDMLawA6bGLDV0rq3GzvRaXFtE7Qbt7+-QDPZb39g8OjpbRvf0C0xOPrm5vTmNSE4ijb17eTsG8Ui6fo9--rmhJPYxqCgA) | [JSON Schema](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoBSBnA9gO1AMoDGAFgKYC2AhqmEvQ40+MgJYUAO2ATgC6gBvUEWydWAGzKgAvqABm3UaADkvAJ4cyAE26sAbmW7LkyEbkz8AamSK8eAZlABeYaI4SyACgHJQodZoAXCrYAEYAVja8ygA0vqDcZACOAK6siVrBANrKAB6xKmoFygBeygC6cX4cipp8rGSYwT5+frnN-hpkwcq4KRShhsoyVa1qHQHdKn0DQyPxfiUTXT0zg0Yy8dLI0gCUJlo24lSJrub8elTiKVMpuADWuNgA7rgmZhagXJisvKx4zlA1lsDgAdBwTpgvJdrmRdq0EYi0B9+N9fv9cM0Foicbi8fiCaA0G1gmtDKNCZSqYTiaBxqAydwKdSWayiWBFqT+utsWy+QS0LIXKCRUA) | [TypeBox](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoBSBnA9gO1AMoDGAFgKYC2AhgFygAqAngA5kBC2AHqmEn-wMHhkASwrNsAJwAuoAN6gi2cSIA2ZUAF9QAM0nLQAcmksyAE0kiAbmUmHR4qbKatd+ikZOsARl0OgA5GQlXExZADUyImkpAGZQAF5FZWY1MgAKFzIAOgB5bwArKOl0uWQAzjos7IA5AFcKb1t0gEoAGnLQRirTWoamyVaOgIAvHtY+xuaW5E0WmeQzKNUqSQ0QsNArKlU6sjo63ABrXGwAd1wgjdkJTBFpETxE0EjouOzmVcwM7d2yFoCgKBgLQ11At3uj1wdDKwLh8IRiKRQLQFTouH6tmGyJxuJxqK66MxkmxeLJ5ICBLGoAxU0knQpjPxYG0SWy7KAA) | [Effect](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFygCiAZi1WZqmEr3-wPDIAljQAOAeyKZQAb1BkJ44QBsqoAL6gWRJaADkmAJ5iq+IsIBuVIvpHipM+ekq1sm7bpoGqbDpjtkRVwAZxkANX8pAGZQAF4FJTFVKgAKF2o6ADowvEISDLdwgEZ012ysIgBXTlTZZFBQAA9GQuyAOSqaACMbABoG0CNW8uwszp7+wYAvEcyxid6iZA0ASnXkZHwOFWJ1YLDQS2wVKqpGKtwAa1wJAHdcTYOZSRDhTGEJXHjQSM4YrJiYghNLHU5UVaNKHQqFoZ6gV7vT64Rj1GHojGYrHY6FoRpEKjYfBfFRGZqMXBdJYDHG0ul0vGgAlEklk4agSmTIg0+m8vmwsD4wnE3Ck0CzDlUmyDfmy2loLQJLLKoA) | [Zod](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFygBaA9vqmEl9z7+MgEsaABxZFMoAN6gyLEQIA2VUAF9QAMyJzQAckwBPYVXxEBANypEdyQSLESAVKGwBnUAC8NWmrvdtryLK4LhIAalRkmGIAzKAAvDJywopUABTuAHQsAEYAVhGYqZLIoKAAHoyZuACuNNmWqQCUADQloPqVGTV1DS1t7p3d9URNyCqNjTb4EQrEykEhoGbYCtVUjNW4ANa4LADuuDYLEqIuApgCLLjxoOGRMRnCxC5py6tUjaVf319ox6Cnc6XXCMYo-cEQyFQ6HfNClCqgIaWVow1FotFw9qMJFEFHo-EE35gUoDRG1YZtQlU1FoNQJDIMoA) | [ArkType](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFygCCRA1gCoCeADlamEkFDhI8MgCWNbgHsimUAG9QZaVPEAbKqAC+oAGZFVoAOSYeVfEXEA3KkWPIJU2fKVneO-YZonird1QOyCq4AM7yAGpUZJiyAMygALzKqtwaVAAUARkKyKCgAB6MxrgArjQARnbGADR5oJzFZZXVdfkAXk3lVfbI2gCU-Y740erEWiHhoNbY6qVUjKW4rLjSAO64jpPyMqHimOLSuEmgUTHxAHTcxKGZM3NU-fnPL89o26C7+4e4jLmvAMBQOBIJeaHyRVAzR6bVBcPhcPBDUY0LssIRGMx+SRnSh3Ts9SxRMRYF0yQuFKAA) | [Valibot](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFygBq2ANgJYBGA9pqmEkFDhI8MnY0ADtyKZQAb1BluU9qyqgAvqABmRFaADkmAJ6Sq+IuwBuVIoeTipMuQCpQ2AM6hru-TSNrNi5eB2RlXE85JioyTBkAZlAAXiUVSTUqAAprADpuTgArWMws+WRQUAAPRjzcAFcaTjssgEoAGgrQE1rchqaWjq6AL17+5qI25E1W1sd8WNZiDQionzZ6qkZ63ABrXG4Ad1xHVblpT3ZMdm5cFOYSxNzJYk9soNZN1sqf35+0M6gC5XG64RjlP6QqHQmGw35oSo1UDjOydOHojEYhHdRgoohozGEon-MCVUbIxoTLrEmnotDaVK5JlAA) | [Arri](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFygCCRRAlqmEtz73+MjY0ADgHsimUAG9QZUSLYAbKqAC+oAGZF5oAOSYAnsKr52ANypFdgkeMkzsazdpp6AAsXZFhZYAGdKWmxrZDlcP0kANSoyTHEAZlAAXll5YSUqAApsADpRACMAKxjMTKlkUFAAD0Zc3ABXGnzLTIBKABoK0ANanIamlo6ugC9e-uaiNuRVVtbkZHwYxWIVMIjQM2xFeqpGetwAa1xRAHdcebXJMT82TDZRXGTQaNiEnOFiPyzN7apWyoBgIBaEuoGut3uuEY5SBsLh8IRiMBaEqNVA40snSR2JxOJR3UYGKIWNxpLJwLAlVG6MaEy65IZ2LQ6hSOTZQA) | [Sury](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YpAoEoDKAXAhgOwCbYBO+GAxgBYCmAttgFwYCuRAnqmEl9z7+MgEsaABwD2RTKADeoMqJECANlVABfUADMi80AHJMrYVXxEBANypFdgkeMkAqUNgDOGTdpp7nLVrtD+AwKDg-zQAFgA6AGZQAGsAIVAAChoBXFAAalAAcwAvAWEASmRkOVxnSQA1KjJMcRiAXll5YSUqJPQI50pabCSpZH8AD0ZO3CYaACNLABpB0FZRiPGp2fncpZXpojnVQuLkfBrFYhUyitAzbEUmKkYmXFjcUQB3XBLzyTFnAUwBUXSTWqtXqEWExGc7SuNyohRCQTQn1A31+-1wjAG8Kx2JxOLQw0YWzWuJJpOx+IWhIm2zmZLp9NAFI2oCJRHmDI55LA6iaET5QA) ... and more
47
45
 
48
46
  ## Overview
49
47
 
50
- TypeDriver is a high-performance validation and type inference middleware designed to integrate JSON Schema and Standard Schema compliant validation into framework interfaces such as HTTP routes and RPC endpoints. It targets type safety at I/O boundaries by providing a unified validation and inference pipeline that can be bound directly to request-receiving interfaces.
48
+ TypeDriver is a validation compiler and type-inference middleware designed to integrate JSON Schema and Standard Schema compliant validation into framework interfaces such as HTTP routes and RPC endpoints. It also functions as a validation optimizer built to accelerate high-throughput messaging systems.
51
49
 
52
50
  This project is designed to unify heterogeneous runtime schema systems based on JSON Schema and Standard Schema into a single system that preserves static type inference, runtime validation, and schema reflection, while remaining compatible with multiple schema ecosystems.
53
51
 
54
52
  License MIT
55
53
 
56
- ## Features
57
-
58
- - Framework Integration
59
- - Designed for [Type-Safe](#Framework) public IO interfaces (Routes)
60
- - One [Function](#Compile) to compile schematics into uniform Validators.
61
- - One [Type](#Static) to infer schematics into TypeScript types.
62
- - [Extension](#Extensions) Model for Framework Specific Runtime Type APIs
63
- - Schema Support
64
- - TypeScript [DSL](#Script) feature for TS7-native (supported in TS5+).
65
- - Scalable [JSON Schema Type Inference](https://tsplay.dev/NlrkxW) as standard.
66
- - Supports JSON Schema Drafts 3 through 2020-12.
67
- - Full support for Standard Schema
68
- - Validation Compiler
69
- - High-performance JIT compiler for faster application start up.
70
- - High-performance runtime validation (approx 2x Ajv under comparable workloads)
71
- - Automatic [Acceleration](#Accelerate) for libraries supporting Standard JSON Schema.
72
- - Automatic JIT fallback for [Content-Security](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP) restrictive environments (Cloudflare)
73
- - Tooling and Interoperability
74
- - JSON Schema [Reflect](#Reflect) API for OpenAPI, MCP, and IDL-Based Systems
75
- - Error [Formats](#Errors) for JSON Schema and Standard Schema Based Systems
76
- - [Localized](#Locales) Error Messages (i18n)
77
-
78
54
  ## Contents
79
55
 
80
56
  - [Overview](#Overview)
@@ -87,12 +63,34 @@ License MIT
87
63
  - [Locales](#Locales)
88
64
  - [Static](#Static)
89
65
  - [Script](#Script)
90
- - [Reflect](#Schema)
66
+ - [Reflect](#Reflect)
91
67
  - [Extensions](#Extensions)
92
68
  - [Accelerate](#Accelerate)
93
69
  - [Compression](#Compression)
94
70
  - [Contribute](#Contribute)
95
71
 
72
+ ## Features
73
+
74
+ - Framework Integration
75
+ - Designed specifically for [type-safe](#Framework) I/O interfaces.
76
+ - One function to [compile](#compile) schematics into Validators.
77
+ - One type to [infer](#Static) schematics into TypeScript types.
78
+ - Schema [extension](#Extensions) model for Framework specific runtime type API
79
+ - Schema Support
80
+ - TypeScript [DSL](#Script) for TS7-native (supported in TS5+).
81
+ - Scalable JSON Schema type inference ([demo](https://tsplay.dev/wjrYMw))
82
+ - Supports JSON Schema Drafts 3 through 2020-12.
83
+ - Full support for Standard Schema
84
+ - Validation Compiler
85
+ - High-performance JIT compiler for faster application start up.
86
+ - High-performance runtime validation (approx 2x Ajv performance)
87
+ - Automatic [acceleration](#Accelerate) for libraries supporting Standard JSON Schema.
88
+ - Automatic JIT fallback for [content-security](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP) restrictive environments (Cloudflare)
89
+ - Tooling and Interoperability
90
+ - JSON Schema [reflect](#Reflect) API for OpenAPI, MCP, and IDL-Based Systems
91
+ - Error [formats](#Errors) for JSON Schema and Standard Schema Based Systems
92
+ - Includes [localized](#Locales) error messages (i18n) as standard.
93
+
96
94
  ## Framework
97
95
 
98
96
  TypeDriver is designed for framework integration. It provides a simple infrastructure to connect type inference and validation to framework interfaces.
@@ -100,6 +98,8 @@ TypeDriver is designed for framework integration. It provides a simple infrastru
100
98
  Ref: [TypeScript](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YyAoEoAiBTAzgSwOYB2qYSZ5FcyADgPbYAuAFAOTAsA0oA3sqKACNaAEwCeALlAADXv34APSYQCuAWwGYAThz5yJoFeq065oAF5K1GzboC+U5La5NNmAI7KcDAJSgAvAB8PLoAxrSEjDyg8lyiXGagtv6grh5eAHRCYqBoDKLUmODYAIYAZpgAhI7eyCQQlA2N8HUAYprFqpgA7rSaANZ1TUPDyLiqdJoMUXkFoADKDMUMuCFcYeO4ADaYiaClmrSqoCwzmMKauABuWiy1mPITU7iEDFqlxSE7AEq0yq8A8tRluFsAAeABCIlEoHur0IwmwoGUhD6hFoXUIyWRqPRhCCskEUMkkLEjmQ90eoFOoB+f0wAGFiptNgIPn1QQAFJYACxh8jhCNAjAuhHwXEBwIifIFiNpAKBuBBQT8oCYuhc7k8jEk3CRmk2ki5DG5XCy+gWSxWoIlioiAG0WGaWABdIK2XyBUCXWi4YTIGoU3pTUrIkKS0B0RicnnSzDwxHC55i0BhCJTG0g2Pxmm-eWS7BcXSM5mskJ9ZJyhlMlls6PG8UKpXIAJMag8w08ri0RsRSQZiJraulvqSYs1su+AmpyJmgD6lyZvqWvWS62oW0wTG7+YdTudNX4uREtEk6TPoDG1G2nReKVzO02tHwKzJQA) | [JSON Schema](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YyAoEoAiBTAzgSwOYB2qYSZ5FcyADgPbYAuAFAOTAsA0oA3sqKACNaAEwCeALh59+oBqOqZJLWgIBWmAMYNO0-gCdMARwCuuA8MkBtFgA9OoFqPssAXiwC6HXaGp7aCvQZcHEleGRkbUNl5RQdCYwBbAUw9FlAAXy9w-gkeaIUleKSUtMzvfhcouQK4xOTUjKyZdOkWzNAmAxMcBgBKUABeAD4pfg1aQkY8my5RLhcMwdAu4x6AOiExUDRqzHBsAEMAM0wAQmR03uQSCEo7+-gbgDE9A4TMAHdaPQBrG4eAYDkLgEnRAnldqAAMoMA5BDRccag3AAG0wiyOfgSDl2wj0uAAbiVrpgbGCGKBcIQGCkjgcNOiAEq0Yw0gDy1CCE2wAB4AEIiUSgUk0wjCbCgYyEH6EWgfQhLKUyuWEEZhQSCyQCsQXZCk8n5JksmkAYQOKJRAnpPx5AAU4QALYU2UXi0CMfGEfBcDlcybO10S5mszC+3DckYDDrSTpGVaMKLGPQoyT2hgOribXIwuG4DQ8sPc6xZjwjS6DEYE2i4YTIK7674Uo5SrThhV0Rh2x0BzBiiUeqne0DjSYUwv+kW9t3B9mctvYLjSM0Wq0aH5LGeYZeW61d9M+ucR5BDJjUR2px1cfx+7CSccL4fmndryTb1c-frqkdTLMAfQJ5o1nC3xLEi1CopgTDXvOxaCh4Vz8DsIi0JIaxoZSoJou81LLMa6IorQ+B5rqQA) | [Standard Schema](https://www.typescriptlang.org/play/?target=99&module=7#code/PTAEFpK6dv4YyAoEoAiBTAzgSwOYB2qYSZ5FcyuAtgA4D2ATgC6gBUoAhtqAF6gAZkwY1QAcj4MAJuOTJG2FgApxwcQBpQAb2ShQAIxkBPAFz8AdAwMArTAGMVu-foAe5vhcIBXGgcxMygCUGnouZpY+fgHBoS78Hl6+-oEhYQC+QcjpWspMmACO3jgsQaAAvAB8OmH2DIRKOqCuWsZaAukVoPlFJRZG0sagaCzGdJjg2FyCmACE2VkkEJQrq-BLAGJMXDSYAO7MANZLa6dn1PTMbNqgo+OgAMosXCy49lp19LgANpigncJRBI7phpExcAA3AJyZCYVyMVigXCEFgBQRcex-ABKDG8qIA8nRXvVsAAeABCJlAcNRhGkvG8hEOhAYe0IXUZzNZhGqzkMJnMlMG2Vh8KutzG2NxqIAwlxvt8DBjDqSAAovAAW1NctPpoCU4MI+C0hOJDW1ut4OLxmFNuBJ1XKoGUYTyhWKSnMN28TG+5nVLA1WgGESeLzepLtJIA2uIQ+IALrVTIVaoQhi4aTILJwhFsQSMxz29mKFhqzUWzB03gG5HG0B1BpsKPmmlVvXWglE4vYLRhOUKpX2Q5dTuYAeK5XlwMm7sO5CVZR0TX+zVaBhzhrmFu9hvyyfD8wToeHMp8xuNEMAfQh8szL2YXU+dB+mGUG7N2Fj8YTWX0IxkBhzAsECkXoX5dhRbppT+b4GHwN4RSAA)
101
99
 
102
100
  ```typescript
101
+ // Next Generation Inference System Based on TypeScript DSL (TS7)
102
+
103
103
  route('/', {
104
104
  body: `{
105
105
  x: number,
@@ -142,7 +142,7 @@ export function route<Path extends string, const Options extends RouteOptions,
142
142
  TypeDriver consists of a single compile(...) function that accepts JSON Schema, Standard Schema or TypeScript definition and returns a Validator instance.
143
143
 
144
144
  ```typescript
145
- import { compile } from 'typedriver'
145
+ import compile from 'typedriver'
146
146
  ```
147
147
 
148
148
  Ref: [TypeScript](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYwuYAbApnAvnAMyjTgHIYBPMLAEymADcspSAoV1AOwGd4A1LMhjQAzHAC8KNGExYAFAAMErOHAAeALjicAriABGzFXApbdBo6oBeZvYaitcCgJSq37j56-ef7gPR+Ujz8gsJQIlp8AIYYwDRRYQA8AHSpADSIxr7ZObluAW6a2nbMaVl5FZX5gaqmxRZQZVXNlQXWtg1NLd3ZBbgAfOxcvHCQ3MAwwBCcEnACQqLJYFFQ3PJIxkUADF11AIxdNnBbjs5AA)
@@ -264,7 +264,7 @@ const issues = [
264
264
 
265
265
  ## Locales
266
266
 
267
- TypeDriver has translations for many different languages and locales.
267
+ TypeDriver provides localized translations for multiple languages and locales, using BCP 47-compliant locale identifiers expressed with underscores (_) in place of hyphens (-). These can be passed to the errors(...) function in the following way.
268
268
 
269
269
  ```typescript
270
270
  const issues = Vector3.errors({ x: 1, y: true }, {
@@ -345,11 +345,9 @@ const C = z.object({
345
345
  })
346
346
  ```
347
347
 
348
- Localization support is only available for JSON Schema
349
-
350
348
  ## Script
351
349
 
352
- The TypeScript DSL is a runtime and type-level emulation of TypeScript. This feature is based on TypeBoxs ability to transform TypeScript syntax into JSON Schema. The TypeScript DSL supports most TypeScript definitions, as well as type-level constraints expressed using JSON Schema keywords.
350
+ The [TypeScript DSL](https://sinclairzx81.github.io/typebox/#/docs/script/overview) is a runtime and type-level emulation of TypeScript. This feature is based on TypeBox's ability to transform TypeScript syntax into JSON Schema. The DSL supports most TypeScript definitions, as well as type-level constraints expressed using JSON Schema keywords.
353
351
 
354
352
  > ⚠️ The name `Options<T>` is subject to change. Because Options is a commonly used type name, it may not be appropriate for schema constraint augmentation. As a result, Options should be considered an experimental feature. TypeBox and TypeDriver are open to suggestions for a more suitable name for this type.
355
353
 
@@ -380,7 +378,7 @@ Refer to [TypeBox](https://github.com/sinclairzx81/typebox) for additional infor
380
378
  Validators can reflect back a JSON Schema representation if the underlying type supports it. This is true for all TypeScript and JSON Schema source types. Reflect can be used for OpenAPI metadata publishing, or RPC systems that need to publish JSON based IDL (interface definition language) to remote callers. Validators provide two functions for this.
381
379
 
382
380
  ```typescript
383
- import { compile, type Static } from 'typedriver'
381
+ import compile, { type Static } from 'typedriver'
384
382
 
385
383
  const validator = compile(...)
386
384
 
@@ -394,7 +392,7 @@ validator.toJSONSchema() // Returns the JSON Schema for the validator. If the
394
392
  // empty {} is returned to indicate an unknown
395
393
  // runtime schema.
396
394
  ```
397
- The source type used for compilation can also be returned via
395
+ The original source type used for compilation can also be returned via
398
396
 
399
397
  ```typescript
400
398
  validator.schema() // will return the schematic used for compile.
@@ -407,7 +405,7 @@ TypeDriver enables Frameworks to define custom Runtime Types specific to the Fra
407
405
  Ref: [Framework Types](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAbzgYwuYAbApgGjjATzCzgGUYBDGYZOAXzgDMo04ByQ4gEymADcsUNgChhAejFwAtDNlz5CxUuUrVU8ZICqAZwoBzLBulqTps2uGoAdtvgA1LMhjQAzHAC8KNGExYAFBAARgBWjjB+CMJwcAAeAFxwVgCuIIGCfgCUOFFwBAnJqelZOQBe+SlpUJnCdBkZopwkDk6uHmSU1MgAPI0QjHDNzlAuAHyiEsbmU9MmRppWwBBWACoQy0lg2Ak6WFz4EHAAojEwUBROcAAKLMSwBADSWATaTCwgVzeC1FjaRjP-AIUwkacHmixWEAAklYYIJtGFwV1NCM2n5NHAsCcsFYuC8KFYCHAAPxwPzxUEZDwovgQYB7fJYARQSmY2E4l5khLAKyMQRwSGU9zU2l7EmQuAMpnAogkAAyFFsAHlGEiUZ4wUtVtDYVB4U5EaCMVj2XB8YSSZyKVS4DS6RLEoy+SjWdjcaTydzeVA4LLBcK7STZfarI6oNLiKCFpq1htsEi8PLbG1EzBlaq1XAANqaAC6RrZbszIaZeZJmbzCUzADoaxqIetNlgusdkBgklwm5oEwqYCMRt3bDnxpJAaPAUYAGJnEBYADu0AA1oqQmE-mP11NwyQAEpYACOSWAUF2AEEoGcCF1rhBbt8Xi6TbvUFAuF1bLwrHo8EkrAurBBZysfscmvW8Hiee9jTdd9uT0NpjlOc4YC6Bcnj6D4by+YAfjwGDP2A6JdwPI9T3PChCXVKN61jJtQK+cDnjGDMiMPY8uDPC9hExSBYDgbkdUYc4SCnCgZ3nKAlxXJwr0+WBsMggsXifaBXzwr84B-P8AKAlFImiRoEjYIJQicNg8ByMBZLvBI6LknC4ByY9iLYhIWJI9iyMvWy7zGOguJiHj4EYH99SWOBjLCLprCTbz5PzV0lMcFS31OWDv1-f9AL7PxLMwuztBsqz5IyBIRLExdlxM5DYp+XTHKwGAkigKxEHwGVDIi0y8Cc1jdgSSqwirVDnhyoqfiyOBctvOKGAVB0pT8iYN2W0xJ2nOdFwAOQqQQ1xW-alGEfjBEE5BhPW8SF22wpvT0triEMgpKhEPzuOgIKQuoMKnqKUqLq2nbboc6Jj0a5rWoM9gfqEegaiAA)
408
406
 
409
407
  ```typescript
410
- import { compile, type Static } from 'typedriver'
408
+ import compile, { type Static } from 'typedriver'
411
409
 
412
410
  interface FrameworkString {
413
411
  type: 'string'
@@ -423,8 +421,6 @@ const T = number() // const T: FrameworkString = { type: 'nu
423
421
  type T = Static<typeof T> // type T = number
424
422
  ```
425
423
 
426
- This is an advanced feature based on TypeBox's extension model for JSON Schema.
427
-
428
424
  ## Accelerate
429
425
 
430
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(...).