@arrirpc/schema 0.74.0 → 0.75.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/README.md CHANGED
@@ -988,7 +988,7 @@ const BinaryTreeSchema = a.recursive('BTree', (self) =>
988
988
 
989
989
  ## Compiled Validators
990
990
 
991
- `@arrirpc/schema` comes with a high performance JIT compiler that transforms Arri Schemas into highly optimized validation, parsing, serialization functions. The result of the compilation also implements the [standard-schema](https://github.com/standard-schema/standard-schema) interface, meaning it can be passed into any library that accepts standard-schema.
991
+ `@arrirpc/schema` comes with a high performance JIT compiler that transforms Arri Schemas into highly optimized validation, parsing, coercion, and serialization functions. The result of the compilation also implements the [standard-schema](https://github.com/standard-schema/standard-schema) interface, meaning it can be passed into any library that accepts standard-schema.
992
992
 
993
993
  ```ts
994
994
  const User = a.object({
@@ -1002,6 +1002,8 @@ const $$User = a.compile(User);
1002
1002
  $$User.validate(someInput);
1003
1003
  $$User.parse(someJson);
1004
1004
  $$User.parseUnsafe(someJson);
1005
+ $$User.coerce(someObject);
1006
+ $$User.coerceUnsafe(someObject);
1005
1007
  $$User.serialize({ id: '1', email: null, created: new Date() });
1006
1008
  $$User.serializeUnsafe({ id: '1', email: null, created: new Date() });
1007
1009
  ```
@@ -1013,6 +1015,7 @@ You can also use `a.compile` for code generation. The compiler result gives you
1013
1015
  ```ts
1014
1016
  $$User.compiledCode.validate; // the generated validation code
1015
1017
  $$User.compiledCode.parse; // the generated parsing code
1018
+ $$User.compiledCode.coerce; // the generated coercion code
1016
1019
  $$User.compiledCode.serialize; // the generated serialization code
1017
1020
  ```
1018
1021
 
@@ -1,5 +1,5 @@
1
1
  import { StandardSchemaV1 } from '@standard-schema/spec';
2
- import { V as ValidationContext, A as ASchema } from './shared/schema.BYXPajpl.cjs';
2
+ import { V as ValidationContext, A as ASchema } from './shared/schema.CGpRJ4kH.cjs';
3
3
  import '@arrirpc/type-defs';
4
4
 
5
5
  declare function createStandardSchemaProperty<T>(validate: (input: unknown) => input is T, parse: (input: unknown, ctx: ValidationContext) => T | undefined, vendor?: string): StandardSchemaV1<T>['~standard'];
@@ -1,5 +1,5 @@
1
1
  import { StandardSchemaV1 } from '@standard-schema/spec';
2
- import { V as ValidationContext, A as ASchema } from './shared/schema.BYXPajpl.mjs';
2
+ import { V as ValidationContext, A as ASchema } from './shared/schema.CGpRJ4kH.mjs';
3
3
  import '@arrirpc/type-defs';
4
4
 
5
5
  declare function createStandardSchemaProperty<T>(validate: (input: unknown) => input is T, parse: (input: unknown, ctx: ValidationContext) => T | undefined, vendor?: string): StandardSchemaV1<T>['~standard'];
@@ -1,5 +1,5 @@
1
1
  import { StandardSchemaV1 } from '@standard-schema/spec';
2
- import { V as ValidationContext, A as ASchema } from './shared/schema.BYXPajpl.js';
2
+ import { V as ValidationContext, A as ASchema } from './shared/schema.CGpRJ4kH.js';
3
3
  import '@arrirpc/type-defs';
4
4
 
5
5
  declare function createStandardSchemaProperty<T>(validate: (input: unknown) => input is T, parse: (input: unknown, ctx: ValidationContext) => T | undefined, vendor?: string): StandardSchemaV1<T>['~standard'];