@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 +4 -1
- package/dist/adapters.d.cts +1 -1
- package/dist/adapters.d.mts +1 -1
- package/dist/adapters.d.ts +1 -1
- package/dist/index.cjs +90 -124
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +91 -125
- package/dist/shared/{schema.BYXPajpl.d.cts → schema.CGpRJ4kH.d.cts} +1 -1
- package/dist/shared/{schema.BYXPajpl.d.mts → schema.CGpRJ4kH.d.mts} +1 -1
- package/dist/shared/{schema.BYXPajpl.d.ts → schema.CGpRJ4kH.d.ts} +1 -1
- package/package.json +2 -2
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
|
|
package/dist/adapters.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
-
import { V as ValidationContext, A as ASchema } from './shared/schema.
|
|
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'];
|
package/dist/adapters.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
-
import { V as ValidationContext, A as ASchema } from './shared/schema.
|
|
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'];
|
package/dist/adapters.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
-
import { V as ValidationContext, A as ASchema } from './shared/schema.
|
|
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'];
|