@arrirpc/schema 0.76.4 → 0.77.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
@@ -28,6 +28,7 @@ Originally this library was created as a way for building schemas for [Json Type
28
28
  - [Basic Example](#basic-example)
29
29
  - [Usage with @arrirpc/server](#usage-with-arrirpcserver)
30
30
  - [Compiling to other languages](#compiling-to-other-languages)
31
+ - [Tree-Shakeable Imports](#tree-shakeable-imports)
31
32
  - [Supported Types](#supported-types)
32
33
  - [Primitives](#primitives)
33
34
  - [Enums](#enums)
@@ -79,9 +80,9 @@ const User = a.object({
79
80
 
80
81
  type User = a.infer<typeof User>;
81
82
 
82
- // passes and returns User
83
+ // returns ResultSuccess<User>
83
84
  a.parse(User, `{"id": "1", "name": "John Doe"}`);
84
- // throws error
85
+ // returns ResultFailure
85
86
  a.parse(User, `{"id": "1", "name": null}`);
86
87
 
87
88
  // returns true
@@ -252,6 +253,67 @@ data class User(
252
253
 
253
254
  See [here](/README.md#client-generators) for a list of all officially supported language generators.
254
255
 
256
+ ## Tree-Shakeable Imports
257
+
258
+ For those that are concerned about bundle sizes you can use Arri's optional modular import syntax. This makes it so that bundlers can remove unused Arri functions from JS bundles at build time. You can also enforce this in your codebase using the [arri/prefer-modular-imports](/languages/ts/eslint-plugin/README.md) lint rule.
259
+
260
+ Using the modular import syntax Arri's bundle size can be as small as 4kb depending on how many functions you import.
261
+
262
+ ```ts
263
+ // tree-shakeable (no `a` prefix)
264
+ import { string, boolean, object } from '@arrirpc/schema';
265
+ const User = object({
266
+ id: string(),
267
+ name: string(),
268
+ isAdmin: boolean(),
269
+ });
270
+
271
+ // tree-shakeable (with `a` prefix)
272
+ import * as a from '@arrirpc/schema';
273
+ const User = a.object({
274
+ id: a.string(),
275
+ name: a.string(),
276
+ isAdmin: a.boolean(),
277
+ });
278
+
279
+ // NOT tree-shakeable
280
+ import { a } from '@arrirpc/schema';
281
+ const User = a.object({
282
+ id: a.string(),
283
+ name: a.string(),
284
+ isAdmin: a.boolean(),
285
+ });
286
+ ```
287
+
288
+ Click [here](/languages/ts/ts-schema-benchmarks/README.md#bundle-size) to see how Arri Schema's bundle sizes compares to the rest of the ecosystem.
289
+
290
+ ### Why isn't this the default?
291
+
292
+ Just personal preference. I find manually importing individual functions to be a bad developer experience.
293
+
294
+ ```ts
295
+ // not a fan
296
+ import { foo, bar, baz } from 'foo';
297
+ ```
298
+
299
+ Additionally, having an explicitly exported `a` namespace means that when I type `a.{something}` that the TS language server will autocomplete the available functions even if I haven't imported `@arrirpc/schema` yet. If we didn't have that explicit export, then you would not get autocomplete for `a.{something}` until you added the `import * as a` line to your file.
300
+
301
+ ```ts
302
+ // this has to be added before you get autocomplete for `a.{whatever}`
303
+ import * as a from '@arrirpc/schema';
304
+ ```
305
+
306
+ However I understand that keeping small bundle sizes can be important which is why I've allowed both options:
307
+
308
+ ```ts
309
+ // if you care about bundle size use one of these two
310
+ import * as a from '@arrirpc/schema';
311
+ import { string, object, etc } from '@arrirpc/schema';
312
+
313
+ // if you aren't as particular about bundle sizes then use this
314
+ import { a } from '@arrirpc/schema';
315
+ ```
316
+
255
317
  ## Supported Types
256
318
 
257
319
  ### Primitives
@@ -1024,7 +1086,7 @@ $$User.compiledCode.serialize; // the generated serialization code
1024
1086
 
1025
1087
  ## Benchmarks
1026
1088
 
1027
- _Last Updated: 2024-12-27_
1089
+ _Last Updated: 2025-03-19T21:46:43.732Z_
1028
1090
 
1029
1091
  All benchmarks were run on my personal desktop. You can view the methodology used in [./benchmarks/src](./benchmark/src).
1030
1092
 
@@ -1035,123 +1097,226 @@ RAM - 32GB
1035
1097
  Graphics - AMD® Radeon rx 6900 xt
1036
1098
  ```
1037
1099
 
1100
+ <!-- BENCHMARK_START -->
1101
+
1038
1102
  ### Objects
1039
1103
 
1040
- The following data was used in these benchmarks. Relevant schemas were created in each of the mentioned libraries.
1104
+ The following type was used in these benchmarks. Equivalent schemas were created in each of the mentioned libraries.
1041
1105
 
1042
1106
  ```ts
1043
- {
1044
- id: 12345,
1045
- role: "moderator",
1046
- name: "John Doe",
1047
- email: null,
1048
- createdAt: 0,
1049
- updatedAt: 0,
1050
- settings: {
1051
- preferredTheme: "system",
1052
- allowNotifications: true,
1053
- },
1054
- recentNotifications: [
1055
- {
1056
- type: "POST_LIKE",
1057
- postId: "1",
1058
- userId: "2",
1059
- },
1060
- {
1061
- type: "POST_COMMENT",
1062
- postId: "1",
1063
- userId: "1",
1064
- commentText: "",
1065
- },
1066
- ],
1067
- };
1107
+ interface TestUser {
1108
+ id: number; // integer,
1109
+ role: 'standard' | 'admin' | 'moderator';
1110
+ name: string;
1111
+ email: string | null;
1112
+ createdAt: number; // integer
1113
+ updatedAt: number; // integer
1114
+ settings:
1115
+ | {
1116
+ preferredTheme: 'light' | 'dark' | 'system';
1117
+ allowNotifications: boolean;
1118
+ }
1119
+ | undefined;
1120
+ recentNotifications: Array<
1121
+ | {
1122
+ type: 'POST_LIKE';
1123
+ userId: string;
1124
+ postId: string;
1125
+ }
1126
+ | {
1127
+ type: 'POST_COMMENT';
1128
+ userId: string;
1129
+ postId: string;
1130
+ commentText: string;
1131
+ }
1132
+ >;
1133
+ }
1068
1134
  ```
1069
1135
 
1070
- #### Validation
1071
-
1072
- | Library | op/s |
1073
- | ---------------------------- | -------------- |
1074
- | **Arri (Compiled)** | **51,149,033** |
1075
- | Typebox (Compiled) | 47,826,755 |
1076
- | Ajv -JTD (Compiled) | 32,001,140 |
1077
- | Ajv - JTD | 12,731,224 |
1078
- | Ajv - JSON Schema (Compiled) | 12,371,095 |
1079
- | Ajv -JSON Schema | 8,811,605 |
1080
- | **Arri** | **2,151,961** |
1081
- | Typebox | 1,024,386 |
1082
- | Zod | 471,700 |
1083
-
1084
- #### Parsing
1085
-
1086
- | Library | op/s |
1087
- | ------------------- | ----------- |
1088
- | JSON.parse | 785,364 |
1089
- | **Arri (Compiled)** | **736,957** |
1090
- | **Arri** | **378,841** |
1091
- | Ajv -JTD (Compiled) | 230,124 |
1092
-
1093
- #### Serialization
1094
-
1095
- | Library | op/s |
1096
- | ------------------------------------------ | ------------- |
1097
- | **Arri (Compiled)** | **4,131,382** |
1098
- | **Arri (Compiled) Validate and Serialize** | **3,710,794** |
1099
- | Ajv - JTD (Compiled) | 2,066,041 |
1100
- | JSON.stringify | 1,599,758 |
1101
- | Arri | 467,417 |
1102
-
1103
- #### Coercion
1104
-
1105
- | Library | op/s |
1106
- | -------- | ----------- |
1107
- | **Arri** | **820,103** |
1108
- | Zod | 465,466 |
1109
- | Typebox | 405,292 |
1136
+ #### Object Validation - Good Input
1137
+
1138
+ | Library | op/s |
1139
+ | ------------------------------------- | ---------- |
1140
+ | **Arri (Compiled)** | 54,124,628 |
1141
+ | TypeBox (Compiled) | 42,197,488 |
1142
+ | Ajv - JTD (Compiled) | 31,927,096 |
1143
+ | Arktype | 29,595,516 |
1144
+ | Typia | 28,381,607 |
1145
+ | **Arri (Compiled) - Standard Schema** | 18,826,632 |
1146
+ | Ajv - JSON Schema (Compiled) | 11,420,306 |
1147
+ | Ajv - JTD | 11,368,094 |
1148
+ | Ajv - JSON Schema | 8,370,741 |
1149
+ | **Arri** | 2,732,305 |
1150
+ | **Arri - Standard Schema** | 757,117 |
1151
+ | TypeBox | 733,853 |
1152
+ | Valibot | 607,841 |
1153
+ | Zod | 467,553 |
1154
+
1155
+ #### Object Validation - Bad Input
1156
+
1157
+ | Library | op/s |
1158
+ | ------------------------------------- | ---------- |
1159
+ | **Arri (Compiled)** | 63,206,923 |
1160
+ | TypeBox (Compiled) | 47,209,177 |
1161
+ | Typia | 30,610,871 |
1162
+ | Ajv - JTD (Compiled) | 25,543,957 |
1163
+ | Ajv - JTD | 13,095,043 |
1164
+ | **Arri (Compiled) - Standard Schema** | 8,184,643 |
1165
+ | Ajv - JSON Schema (Compiled) | 4,543,106 |
1166
+ | **Arri** | 4,237,065 |
1167
+ | Ajv - JSON Schema | 3,790,517 |
1168
+ | TypeBox | 906,797 |
1169
+ | **Arri - Standard-Schema** | 794,635 |
1170
+ | Valibot | 485,994 |
1171
+ | Zod | 321,011 |
1172
+ | Arktype | 139,720 |
1173
+
1174
+ #### Object Parsing - Good Input
1175
+
1176
+ | Library | op/s |
1177
+ | ------------------------------------- | ------- |
1178
+ | JSON.parse | 773,939 |
1179
+ | JSON.parse + Typebox (Compiled) | 746,709 |
1180
+ | Typia (json.createValidateParse) | 736,675 |
1181
+ | JSON.parse + Arktype | 736,157 |
1182
+ | **Arri (Compiled)** | 722,323 |
1183
+ | **Arri (Compiled) - Standard Schema** | 711,010 |
1184
+ | **Arri - Standard Schema** | 348,920 |
1185
+ | **Arri** | 348,467 |
1186
+ | JSON.parse + Valibot | 314,205 |
1187
+ | JSON.parse + Zod | 280,872 |
1188
+ | Ajv - JTD (Compiled) | 261,253 |
1189
+ | JSON.parse + Typebox | 215,239 |
1190
+
1191
+ #### Object Parsing - Bad Input
1192
+
1193
+ | Library | op/s |
1194
+ | ------------------------------------- | ------- |
1195
+ | JSON.parse | 871,925 |
1196
+ | **Arri (Compiled)** | 796,037 |
1197
+ | **Arri (Compiled) - Standard Schema** | 728,394 |
1198
+ | Typia (json.createValidateParse) | 556,550 |
1199
+ | **Arri** | 415,938 |
1200
+ | **Arri - StandardSchema** | 395,654 |
1201
+ | Ajv - JTD (Compiled) | 332,767 |
1202
+ | JSON.parse + Valibot | 300,625 |
1203
+ | JSON.parse + Zod | 215,862 |
1204
+ | JSON.parse + Arktype | 119,465 |
1205
+ | JSON.parse + Typebox (Compiled) | 96,386 |
1206
+ | JSON.parse + Typebox | 77,921 |
1207
+
1208
+ #### Object Serialization
1209
+
1210
+ | Library | op/s |
1211
+ | -------------------------------------------- | --------- |
1212
+ | **Arri (Compiled)** | 4,342,282 |
1213
+ | **Arri (Compiled) - Validate and Serialize** | 3,869,687 |
1214
+ | Ajv - JTD (Compiled) | 2,100,923 |
1215
+ | Typia | 1,823,903 |
1216
+ | JSON.stringify | 1,635,149 |
1217
+ | Typia - Validate and Serialize | 1,570,486 |
1218
+ | **Arri** | 471,954 |
1219
+
1220
+ #### Object Coercion
1221
+
1222
+ | Library | op/s |
1223
+ | ------------------- | ---------- |
1224
+ | **Arri (Compiled)** | 19,743,175 |
1225
+ | **Arri** | 787,241 |
1226
+ | Zod | 442,329 |
1227
+ | TypeBox | 403,062 |
1110
1228
 
1111
1229
  ### Integers
1112
1230
 
1113
1231
  The following benchmarks measure how quickly each library operates on a single integer value.
1114
1232
 
1115
- #### Validation
1116
-
1117
- | Library | op/s |
1118
- | ---------------------------- | --------------- |
1119
- | Typebox (Compiled) | 196,718,452 |
1120
- | **Arri (Compiled)** | **190,853,038** |
1121
- | Ajv - JSON Schema (Compiled) | 189,905,832 |
1122
- | Ajv - JTD (Compiled) | 143,619,126 |
1123
- | **Arri** | **89,428,888** |
1124
- | Typebox | 48,408,435 |
1125
- | Ajv - JSON Schema | 36,560,467 |
1126
- | Ajv - JTD | 35,639,616 |
1127
- | Zod | 1,286,707 |
1128
-
1129
- #### Parsing
1130
-
1131
- | Library | op/s |
1132
- | -------------------- | --------------- |
1133
- | **Arri (Compiled)** | **131,214,018** |
1134
- | **Arri** | **56,134,552** |
1135
- | JSON.parse() | 21,001,320 |
1136
- | Ajv - JTD (Compiled) | 9,441,285 |
1137
-
1138
- #### Serialization
1139
-
1140
- | Library | op/s |
1141
- | -------------------- | --------------- |
1142
- | Ajv - JTD (Compiled) | 199,802,584 |
1143
- | **Arri (Compiled)** | **194,399,849** |
1144
- | **Arri** | **65,097,829** |
1145
- | JSON.stringify | 16,853,237 |
1146
-
1147
- #### Coercion
1148
-
1149
- | Library | op/s |
1150
- | ----------------- | -------------- |
1151
- | **Arri** | **55,840,221** |
1152
- | TypeBox | 34,403,424 |
1153
- | Ajv - JSON Schema | 22,190,607 |
1154
- | Zod | 1,195,111 |
1233
+ #### Int Validation
1234
+
1235
+ | Library | op/s |
1236
+ | ------------------------------------- | ----------- |
1237
+ | Ajv - JTD (Compiled) | 192,026,130 |
1238
+ | TypeBox (Compiled) | 190,783,837 |
1239
+ | **Arri (Compiled)** | 188,138,821 |
1240
+ | Ajv - JSON Schema (Compiled) | 182,920,826 |
1241
+ | **Arri - Standard Schema** | 110,055,872 |
1242
+ | **Arri (Compiled) - Standard Schema** | 109,070,056 |
1243
+ | **Arri** | 81,658,732 |
1244
+ | Typia | 61,029,032 |
1245
+ | Arktype | 54,370,348 |
1246
+ | TypeBox | 48,673,070 |
1247
+ | Ajv - JTD | 31,204,944 |
1248
+ | Ajv - JSON Schema | 31,075,953 |
1249
+ | Valibot | 23,309,004 |
1250
+ | Zod | 1,277,690 |
1251
+
1252
+ #### Int Validation (Bad Input)
1253
+
1254
+ | Library | op/s |
1255
+ | ------------------------------------- | ----------- |
1256
+ | TypeBox (Compiled) | 190,126,454 |
1257
+ | **Arri (Compiled)** | 189,172,106 |
1258
+ | Ajv - JSON Schema (Compiled) | 75,375,601 |
1259
+ | Ajv - JTD (Compiled) | 74,177,660 |
1260
+ | Typia | 58,363,051 |
1261
+ | TypeBox | 45,205,805 |
1262
+ | **Arri** | 42,222,871 |
1263
+ | Ajv - JSON Schema | 19,876,104 |
1264
+ | Ajv - JTD | 19,027,047 |
1265
+ | **Arri (Compiled) - Standard Schema** | 17,164,858 |
1266
+ | **Arri - Standard Schema** | 12,296,640 |
1267
+ | Valibot | 9,545,070 |
1268
+ | Zod | 799,307 |
1269
+ | Arktype | 451,199 |
1270
+
1271
+ #### Int Parsing (Good Input)
1272
+
1273
+ | Library | op/s |
1274
+ | -------------------- | ----------- |
1275
+ | **Arri (Compiled)** | 130,550,378 |
1276
+ | **Arri** | 49,495,612 |
1277
+ | JSON.parse() | 17,843,485 |
1278
+ | Ajv - JTD (Compiled) | 9,664,631 |
1279
+
1280
+ #### Int Parsing (Bad Input)
1281
+
1282
+ | Library | op/s |
1283
+ | -------------------- | ---------- |
1284
+ | **Arri (Compiled)** | 60,596,060 |
1285
+ | JSON.parse() | 11,390,955 |
1286
+ | **Arri** | 10,151,546 |
1287
+ | Ajv - JTD (Compiled) | 8,524,414 |
1288
+
1289
+ #### Int Serialization
1290
+
1291
+ | Library | op/s |
1292
+ | -------------------------------------------- | ----------- |
1293
+ | **Arri (Compiled)** | 199,750,275 |
1294
+ | **Arri (Compiled) - Validate and Serialize** | 190,585,727 |
1295
+ | Ajv - JTD (Compiled) | 188,008,270 |
1296
+ | Typia | 108,341,757 |
1297
+ | **Arri** | 62,210,662 |
1298
+ | Typia - Validate and Serialize | 45,562,047 |
1299
+ | JSON.stringify | 16,575,449 |
1300
+
1301
+ #### Int Coercion (Good Input)
1302
+
1303
+ | Library | op/s |
1304
+ | ----------------- | ---------- |
1305
+ | **Arri** | 51,421,819 |
1306
+ | TypeBox | 35,333,297 |
1307
+ | Ajv - JSON Schema | 21,583,903 |
1308
+ | Zod | 1,239,520 |
1309
+
1310
+ #### Int Coercion (Bad Input)
1311
+
1312
+ | Library | op/s |
1313
+ | ----------------- | ---------- |
1314
+ | **Arri** | 10,442,645 |
1315
+ | TypeBox | 7,919,097 |
1316
+ | Ajv - JSON Schema | 5,867,676 |
1317
+ | Zod | 737,348 |
1318
+
1319
+ <!-- BENCHMARK_END -->
1155
1320
 
1156
1321
  ## Development
1157
1322
 
@@ -1,5 +1,5 @@
1
1
  import { StandardSchemaV1 } from '@standard-schema/spec';
2
- import { V as ValidationContext, A as ASchema } from './shared/schema.CGpRJ4kH.cjs';
2
+ import { V as ValidationContext, A as ASchema } from './shared/schema.hMebmI3A.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.CGpRJ4kH.mjs';
2
+ import { V as ValidationContext, A as ASchema } from './shared/schema.hMebmI3A.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.CGpRJ4kH.js';
2
+ import { V as ValidationContext, A as ASchema } from './shared/schema.hMebmI3A.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'];
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Schema } from '@arrirpc/type-defs';
2
2
  import { StandardSchemaV1 } from '@standard-schema/spec';
3
- import { A as ASchema, a as ASchemaStrict, I as InferType, R as Result, S as SchemaValidator, b as ASchemaOptions, c as ASchemaWithAdapters, d as AArraySchema, W as WithAdapters, e as AScalarSchemaWithAdapters, f as AObjectSchema, g as ADiscriminatorSchemaWithAdapters, h as ResolveObject, i as AStringEnumSchemaWithAdapters, j as AObjectSchemaWithAdapters, k as AObjectSchemaOptions, l as InferObjectOutput, V as ValidationContext, m as ARecordSchemaWithAdapters, n as ARefSchema, o as ValueError, p as InferSubType } from './shared/schema.CGpRJ4kH.cjs';
4
- export { G as AArraySchemaWithAdapters, K as ADiscriminatorSchema, O as ARecordSchema, Z as ARefSchemaWithAdapters, C as AScalarSchema, H as AStringEnumSchema, U as InferObjectRawType, M as MaybeNullable, E as NumberType, N as NumberTypeValues, P as PartialBy, B as Resolve, v as ResultFailure, u as ResultSuccess, y as SchemaMetadata, x as VALIDATOR_KEY, s as ValidationException, r as errorMessageFromErrors, F as isAAraySchema, L as isADiscriminatorSchema, T as isAObjectSchema, Q as isARecordSchema, Y as isARefSchema, D as isAScalarSchema, z as isASchema, J as isAStringEnumSchema, X as isObject, t as isValidationException, q as isValueError, w as newValidationContext } from './shared/schema.CGpRJ4kH.cjs';
3
+ import { A as ASchema, a as ASchemaStrict, I as InferType, R as Result, S as SchemaValidator, b as ASchemaOptions, c as ASchemaWithAdapters, d as AArraySchema, W as WithAdapters, e as AScalarSchemaWithAdapters, f as AObjectSchema, g as ADiscriminatorSchemaWithAdapters, h as ResolveObject, i as AStringEnumSchemaWithAdapters, j as AObjectSchemaWithAdapters, k as AObjectSchemaOptions, l as InferObjectOutput, V as ValidationContext, m as ARecordSchemaWithAdapters, n as ARefSchema, o as ValueError, p as InferSubType } from './shared/schema.hMebmI3A.cjs';
4
+ export { G as AArraySchemaWithAdapters, K as ADiscriminatorSchema, O as ARecordSchema, Z as ARefSchemaWithAdapters, C as AScalarSchema, H as AStringEnumSchema, U as InferObjectRawType, M as MaybeNullable, E as NumberType, N as NumberTypeValues, P as PartialBy, B as Resolve, v as ResultFailure, u as ResultSuccess, y as SchemaMetadata, x as VALIDATOR_KEY, s as ValidationException, r as errorMessageFromErrors, F as isAAraySchema, L as isADiscriminatorSchema, T as isAObjectSchema, Q as isARecordSchema, Y as isARefSchema, D as isAScalarSchema, z as isASchema, J as isAStringEnumSchema, X as isObject, t as isValidationException, q as isValueError, w as newValidationContext } from './shared/schema.hMebmI3A.cjs';
5
5
 
6
6
  declare function createParsingTemplate(input: string, schema: Schema, shouldCoerce?: boolean): string;
7
7
 
@@ -177,6 +177,23 @@ declare function nullable<T>(schema: ASchema<T>, opts?: ASchemaOptions): ASchema
177
177
  declare function optional<T>(input: ASchema<T>, opts?: ASchemaOptions): ASchema<T | undefined>;
178
178
  declare function clone<T>(input: ASchema<T>, opts?: ASchemaOptions): ASchemaWithAdapters<T>;
179
179
 
180
+ declare const int8Min = -128;
181
+ declare const int8Max = 127;
182
+ declare const uint8Min = 0;
183
+ declare const uint8Max = 255;
184
+ declare const int16Min = -32768;
185
+ declare const int16Max = 32767;
186
+ declare const uint16Min = 0;
187
+ declare const uint16Max = 65535;
188
+ declare const int32Min = -2147483648;
189
+ declare const int32Max = 2147483647;
190
+ declare const uint32Min = 0;
191
+ declare const uint32Max = 4294967295;
192
+ declare const int64Min: bigint;
193
+ declare const int64Max: bigint;
194
+ declare const uint64Min: bigint;
195
+ declare const uint64Max: bigint;
196
+
180
197
  /**
181
198
  * Alias for float64 as that is the only number type that Javascript uses
182
199
  *
@@ -386,24 +403,49 @@ declare const _namespace_uint64: typeof uint64;
386
403
  declare const _namespace_uint8: typeof uint8;
387
404
  declare const _namespace_validate: typeof validate;
388
405
  declare namespace _namespace {
389
- export { _namespace_any as any, _namespace_array as array, _namespace_boolean as boolean, _namespace_clone as clone, _namespace_coerce as coerce, _namespace_coerceUnsafe as coerceUnsafe, _namespace_compile as compile, _namespace_discriminator as discriminator, _namespace_enumerator as enumerator, _namespace_errors as errors, _namespace_extend as extend, _namespace_float32 as float32, _namespace_float64 as float64, InferType as infer, InferSubType as inferSubType, _namespace_int16 as int16, _namespace_int32 as int32, _namespace_int64 as int64, _namespace_int8 as int8, _namespace_nullable as nullable, _namespace_number as number, _namespace_object as object, _namespace_omit as omit, _namespace_optional as optional, _namespace_parse as parse, _namespace_parseUnsafe as parseUnsafe, _namespace_partial as partial, _namespace_pick as pick, _namespace_record as record, _namespace_recursive as recursive, _namespace_serialize as serialize, _namespace_serializeUnsafe as serializeUnsafe, _namespace_string as string, _namespace_stringEnum as stringEnum, _namespace_timestamp as timestamp, _namespace_uint16 as uint16, _namespace_uint32 as uint32, _namespace_uint64 as uint64, _namespace_uint8 as uint8, _namespace_validate as validate };
406
+ export {
407
+ _namespace_any as any,
408
+ _namespace_array as array,
409
+ _namespace_boolean as boolean,
410
+ _namespace_clone as clone,
411
+ _namespace_coerce as coerce,
412
+ _namespace_coerceUnsafe as coerceUnsafe,
413
+ _namespace_compile as compile,
414
+ _namespace_discriminator as discriminator,
415
+ _namespace_enumerator as enumerator,
416
+ _namespace_errors as errors,
417
+ _namespace_extend as extend,
418
+ _namespace_float32 as float32,
419
+ _namespace_float64 as float64,
420
+ InferType as infer,
421
+ InferSubType as inferSubType,
422
+ _namespace_int16 as int16,
423
+ _namespace_int32 as int32,
424
+ _namespace_int64 as int64,
425
+ _namespace_int8 as int8,
426
+ _namespace_nullable as nullable,
427
+ _namespace_number as number,
428
+ _namespace_object as object,
429
+ _namespace_omit as omit,
430
+ _namespace_optional as optional,
431
+ _namespace_parse as parse,
432
+ _namespace_parseUnsafe as parseUnsafe,
433
+ _namespace_partial as partial,
434
+ _namespace_pick as pick,
435
+ _namespace_record as record,
436
+ _namespace_recursive as recursive,
437
+ _namespace_serialize as serialize,
438
+ _namespace_serializeUnsafe as serializeUnsafe,
439
+ _namespace_string as string,
440
+ _namespace_stringEnum as stringEnum,
441
+ _namespace_timestamp as timestamp,
442
+ _namespace_uint16 as uint16,
443
+ _namespace_uint32 as uint32,
444
+ _namespace_uint64 as uint64,
445
+ _namespace_uint8 as uint8,
446
+ _namespace_validate as validate,
447
+ };
390
448
  }
391
449
 
392
- declare const int8Min = -128;
393
- declare const int8Max = 127;
394
- declare const uint8Min = 0;
395
- declare const uint8Max = 255;
396
- declare const int16Min = -32768;
397
- declare const int16Max = 32767;
398
- declare const uint16Min = 0;
399
- declare const uint16Max = 65535;
400
- declare const int32Min = -2147483648;
401
- declare const int32Max = 2147483647;
402
- declare const uint32Min = 0;
403
- declare const uint32Max = 4294967295;
404
- declare const int64Min: bigint;
405
- declare const int64Max: bigint;
406
- declare const uint64Min: bigint;
407
- declare const uint64Max: bigint;
408
-
409
- export { AArraySchema, ADiscriminatorSchemaWithAdapters, AObjectSchema, AObjectSchemaOptions, AObjectSchemaWithAdapters, ARecordSchemaWithAdapters, ARefSchema, AScalarSchemaWithAdapters, ASchema, ASchemaOptions, ASchemaStrict, ASchemaWithAdapters, AStringEnumSchemaWithAdapters, type CompiledValidator, type CompiledValidatorCompiledCode, InferObjectOutput, InferSubType, InferType, ResolveObject, Result, STR_ESCAPE, SchemaValidator, ValidationContext, ValueError, WithAdapters, _namespace as a, any, array, boolean, clone, coerce, coerceUnsafe, compile, decodeObjectSchema, discriminator, enumerator, errors, extend, float32, float64, getCompiledParser, getCompiledSerializer, createParsingTemplate as getSchemaDecodingCode, createSerializationV2Template as getSchemaSerializationCode, createValidationTemplate as getSchemaValidationCode, int16, int16Max, int16Min, int32, int32Max, int32Min, int64, int64Max, int64Min, int8, int8Max, int8Min, nullable, number, object, omit, optional, parse, parseUnsafe, partial, pick, record, recursive, sanitizeJson, serialize, serializeObject, serializeSmallString, serializeString, serializeUnsafe, string, stringEnum, timestamp, uint16, uint16Max, uint16Min, uint32, uint32Max, uint32Min, uint64, uint64Max, uint64Min, uint8, uint8Max, uint8Min, validate, validateObjectSchema };
450
+ export { AArraySchema, ADiscriminatorSchemaWithAdapters, AObjectSchema, AObjectSchemaOptions, AObjectSchemaWithAdapters, ARecordSchemaWithAdapters, ARefSchema, AScalarSchemaWithAdapters, ASchema, ASchemaOptions, ASchemaStrict, ASchemaWithAdapters, AStringEnumSchemaWithAdapters, InferObjectOutput, InferSubType, InferType, ResolveObject, Result, STR_ESCAPE, SchemaValidator, ValidationContext, ValueError, WithAdapters, _namespace as a, any, array, boolean, clone, coerce, coerceUnsafe, compile, decodeObjectSchema, discriminator, enumerator, errors, extend, float32, float64, getCompiledParser, getCompiledSerializer, createParsingTemplate as getSchemaDecodingCode, createSerializationV2Template as getSchemaSerializationCode, createValidationTemplate as getSchemaValidationCode, int16, int16Max, int16Min, int32, int32Max, int32Min, int64, int64Max, int64Min, int8, int8Max, int8Min, nullable, number, object, omit, optional, parse, parseUnsafe, partial, pick, record, recursive, sanitizeJson, serialize, serializeObject, serializeSmallString, serializeString, serializeUnsafe, string, stringEnum, timestamp, uint16, uint16Max, uint16Min, uint32, uint32Max, uint32Min, uint64, uint64Max, uint64Min, uint8, uint8Max, uint8Min, validate, validateObjectSchema };
451
+ export type { CompiledValidator, CompiledValidatorCompiledCode };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Schema } from '@arrirpc/type-defs';
2
2
  import { StandardSchemaV1 } from '@standard-schema/spec';
3
- import { A as ASchema, a as ASchemaStrict, I as InferType, R as Result, S as SchemaValidator, b as ASchemaOptions, c as ASchemaWithAdapters, d as AArraySchema, W as WithAdapters, e as AScalarSchemaWithAdapters, f as AObjectSchema, g as ADiscriminatorSchemaWithAdapters, h as ResolveObject, i as AStringEnumSchemaWithAdapters, j as AObjectSchemaWithAdapters, k as AObjectSchemaOptions, l as InferObjectOutput, V as ValidationContext, m as ARecordSchemaWithAdapters, n as ARefSchema, o as ValueError, p as InferSubType } from './shared/schema.CGpRJ4kH.mjs';
4
- export { G as AArraySchemaWithAdapters, K as ADiscriminatorSchema, O as ARecordSchema, Z as ARefSchemaWithAdapters, C as AScalarSchema, H as AStringEnumSchema, U as InferObjectRawType, M as MaybeNullable, E as NumberType, N as NumberTypeValues, P as PartialBy, B as Resolve, v as ResultFailure, u as ResultSuccess, y as SchemaMetadata, x as VALIDATOR_KEY, s as ValidationException, r as errorMessageFromErrors, F as isAAraySchema, L as isADiscriminatorSchema, T as isAObjectSchema, Q as isARecordSchema, Y as isARefSchema, D as isAScalarSchema, z as isASchema, J as isAStringEnumSchema, X as isObject, t as isValidationException, q as isValueError, w as newValidationContext } from './shared/schema.CGpRJ4kH.mjs';
3
+ import { A as ASchema, a as ASchemaStrict, I as InferType, R as Result, S as SchemaValidator, b as ASchemaOptions, c as ASchemaWithAdapters, d as AArraySchema, W as WithAdapters, e as AScalarSchemaWithAdapters, f as AObjectSchema, g as ADiscriminatorSchemaWithAdapters, h as ResolveObject, i as AStringEnumSchemaWithAdapters, j as AObjectSchemaWithAdapters, k as AObjectSchemaOptions, l as InferObjectOutput, V as ValidationContext, m as ARecordSchemaWithAdapters, n as ARefSchema, o as ValueError, p as InferSubType } from './shared/schema.hMebmI3A.mjs';
4
+ export { G as AArraySchemaWithAdapters, K as ADiscriminatorSchema, O as ARecordSchema, Z as ARefSchemaWithAdapters, C as AScalarSchema, H as AStringEnumSchema, U as InferObjectRawType, M as MaybeNullable, E as NumberType, N as NumberTypeValues, P as PartialBy, B as Resolve, v as ResultFailure, u as ResultSuccess, y as SchemaMetadata, x as VALIDATOR_KEY, s as ValidationException, r as errorMessageFromErrors, F as isAAraySchema, L as isADiscriminatorSchema, T as isAObjectSchema, Q as isARecordSchema, Y as isARefSchema, D as isAScalarSchema, z as isASchema, J as isAStringEnumSchema, X as isObject, t as isValidationException, q as isValueError, w as newValidationContext } from './shared/schema.hMebmI3A.mjs';
5
5
 
6
6
  declare function createParsingTemplate(input: string, schema: Schema, shouldCoerce?: boolean): string;
7
7
 
@@ -177,6 +177,23 @@ declare function nullable<T>(schema: ASchema<T>, opts?: ASchemaOptions): ASchema
177
177
  declare function optional<T>(input: ASchema<T>, opts?: ASchemaOptions): ASchema<T | undefined>;
178
178
  declare function clone<T>(input: ASchema<T>, opts?: ASchemaOptions): ASchemaWithAdapters<T>;
179
179
 
180
+ declare const int8Min = -128;
181
+ declare const int8Max = 127;
182
+ declare const uint8Min = 0;
183
+ declare const uint8Max = 255;
184
+ declare const int16Min = -32768;
185
+ declare const int16Max = 32767;
186
+ declare const uint16Min = 0;
187
+ declare const uint16Max = 65535;
188
+ declare const int32Min = -2147483648;
189
+ declare const int32Max = 2147483647;
190
+ declare const uint32Min = 0;
191
+ declare const uint32Max = 4294967295;
192
+ declare const int64Min: bigint;
193
+ declare const int64Max: bigint;
194
+ declare const uint64Min: bigint;
195
+ declare const uint64Max: bigint;
196
+
180
197
  /**
181
198
  * Alias for float64 as that is the only number type that Javascript uses
182
199
  *
@@ -386,24 +403,49 @@ declare const _namespace_uint64: typeof uint64;
386
403
  declare const _namespace_uint8: typeof uint8;
387
404
  declare const _namespace_validate: typeof validate;
388
405
  declare namespace _namespace {
389
- export { _namespace_any as any, _namespace_array as array, _namespace_boolean as boolean, _namespace_clone as clone, _namespace_coerce as coerce, _namespace_coerceUnsafe as coerceUnsafe, _namespace_compile as compile, _namespace_discriminator as discriminator, _namespace_enumerator as enumerator, _namespace_errors as errors, _namespace_extend as extend, _namespace_float32 as float32, _namespace_float64 as float64, InferType as infer, InferSubType as inferSubType, _namespace_int16 as int16, _namespace_int32 as int32, _namespace_int64 as int64, _namespace_int8 as int8, _namespace_nullable as nullable, _namespace_number as number, _namespace_object as object, _namespace_omit as omit, _namespace_optional as optional, _namespace_parse as parse, _namespace_parseUnsafe as parseUnsafe, _namespace_partial as partial, _namespace_pick as pick, _namespace_record as record, _namespace_recursive as recursive, _namespace_serialize as serialize, _namespace_serializeUnsafe as serializeUnsafe, _namespace_string as string, _namespace_stringEnum as stringEnum, _namespace_timestamp as timestamp, _namespace_uint16 as uint16, _namespace_uint32 as uint32, _namespace_uint64 as uint64, _namespace_uint8 as uint8, _namespace_validate as validate };
406
+ export {
407
+ _namespace_any as any,
408
+ _namespace_array as array,
409
+ _namespace_boolean as boolean,
410
+ _namespace_clone as clone,
411
+ _namespace_coerce as coerce,
412
+ _namespace_coerceUnsafe as coerceUnsafe,
413
+ _namespace_compile as compile,
414
+ _namespace_discriminator as discriminator,
415
+ _namespace_enumerator as enumerator,
416
+ _namespace_errors as errors,
417
+ _namespace_extend as extend,
418
+ _namespace_float32 as float32,
419
+ _namespace_float64 as float64,
420
+ InferType as infer,
421
+ InferSubType as inferSubType,
422
+ _namespace_int16 as int16,
423
+ _namespace_int32 as int32,
424
+ _namespace_int64 as int64,
425
+ _namespace_int8 as int8,
426
+ _namespace_nullable as nullable,
427
+ _namespace_number as number,
428
+ _namespace_object as object,
429
+ _namespace_omit as omit,
430
+ _namespace_optional as optional,
431
+ _namespace_parse as parse,
432
+ _namespace_parseUnsafe as parseUnsafe,
433
+ _namespace_partial as partial,
434
+ _namespace_pick as pick,
435
+ _namespace_record as record,
436
+ _namespace_recursive as recursive,
437
+ _namespace_serialize as serialize,
438
+ _namespace_serializeUnsafe as serializeUnsafe,
439
+ _namespace_string as string,
440
+ _namespace_stringEnum as stringEnum,
441
+ _namespace_timestamp as timestamp,
442
+ _namespace_uint16 as uint16,
443
+ _namespace_uint32 as uint32,
444
+ _namespace_uint64 as uint64,
445
+ _namespace_uint8 as uint8,
446
+ _namespace_validate as validate,
447
+ };
390
448
  }
391
449
 
392
- declare const int8Min = -128;
393
- declare const int8Max = 127;
394
- declare const uint8Min = 0;
395
- declare const uint8Max = 255;
396
- declare const int16Min = -32768;
397
- declare const int16Max = 32767;
398
- declare const uint16Min = 0;
399
- declare const uint16Max = 65535;
400
- declare const int32Min = -2147483648;
401
- declare const int32Max = 2147483647;
402
- declare const uint32Min = 0;
403
- declare const uint32Max = 4294967295;
404
- declare const int64Min: bigint;
405
- declare const int64Max: bigint;
406
- declare const uint64Min: bigint;
407
- declare const uint64Max: bigint;
408
-
409
- export { AArraySchema, ADiscriminatorSchemaWithAdapters, AObjectSchema, AObjectSchemaOptions, AObjectSchemaWithAdapters, ARecordSchemaWithAdapters, ARefSchema, AScalarSchemaWithAdapters, ASchema, ASchemaOptions, ASchemaStrict, ASchemaWithAdapters, AStringEnumSchemaWithAdapters, type CompiledValidator, type CompiledValidatorCompiledCode, InferObjectOutput, InferSubType, InferType, ResolveObject, Result, STR_ESCAPE, SchemaValidator, ValidationContext, ValueError, WithAdapters, _namespace as a, any, array, boolean, clone, coerce, coerceUnsafe, compile, decodeObjectSchema, discriminator, enumerator, errors, extend, float32, float64, getCompiledParser, getCompiledSerializer, createParsingTemplate as getSchemaDecodingCode, createSerializationV2Template as getSchemaSerializationCode, createValidationTemplate as getSchemaValidationCode, int16, int16Max, int16Min, int32, int32Max, int32Min, int64, int64Max, int64Min, int8, int8Max, int8Min, nullable, number, object, omit, optional, parse, parseUnsafe, partial, pick, record, recursive, sanitizeJson, serialize, serializeObject, serializeSmallString, serializeString, serializeUnsafe, string, stringEnum, timestamp, uint16, uint16Max, uint16Min, uint32, uint32Max, uint32Min, uint64, uint64Max, uint64Min, uint8, uint8Max, uint8Min, validate, validateObjectSchema };
450
+ export { AArraySchema, ADiscriminatorSchemaWithAdapters, AObjectSchema, AObjectSchemaOptions, AObjectSchemaWithAdapters, ARecordSchemaWithAdapters, ARefSchema, AScalarSchemaWithAdapters, ASchema, ASchemaOptions, ASchemaStrict, ASchemaWithAdapters, AStringEnumSchemaWithAdapters, InferObjectOutput, InferSubType, InferType, ResolveObject, Result, STR_ESCAPE, SchemaValidator, ValidationContext, ValueError, WithAdapters, _namespace as a, any, array, boolean, clone, coerce, coerceUnsafe, compile, decodeObjectSchema, discriminator, enumerator, errors, extend, float32, float64, getCompiledParser, getCompiledSerializer, createParsingTemplate as getSchemaDecodingCode, createSerializationV2Template as getSchemaSerializationCode, createValidationTemplate as getSchemaValidationCode, int16, int16Max, int16Min, int32, int32Max, int32Min, int64, int64Max, int64Min, int8, int8Max, int8Min, nullable, number, object, omit, optional, parse, parseUnsafe, partial, pick, record, recursive, sanitizeJson, serialize, serializeObject, serializeSmallString, serializeString, serializeUnsafe, string, stringEnum, timestamp, uint16, uint16Max, uint16Min, uint32, uint32Max, uint32Min, uint64, uint64Max, uint64Min, uint8, uint8Max, uint8Min, validate, validateObjectSchema };
451
+ export type { CompiledValidator, CompiledValidatorCompiledCode };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Schema } from '@arrirpc/type-defs';
2
2
  import { StandardSchemaV1 } from '@standard-schema/spec';
3
- import { A as ASchema, a as ASchemaStrict, I as InferType, R as Result, S as SchemaValidator, b as ASchemaOptions, c as ASchemaWithAdapters, d as AArraySchema, W as WithAdapters, e as AScalarSchemaWithAdapters, f as AObjectSchema, g as ADiscriminatorSchemaWithAdapters, h as ResolveObject, i as AStringEnumSchemaWithAdapters, j as AObjectSchemaWithAdapters, k as AObjectSchemaOptions, l as InferObjectOutput, V as ValidationContext, m as ARecordSchemaWithAdapters, n as ARefSchema, o as ValueError, p as InferSubType } from './shared/schema.CGpRJ4kH.js';
4
- export { G as AArraySchemaWithAdapters, K as ADiscriminatorSchema, O as ARecordSchema, Z as ARefSchemaWithAdapters, C as AScalarSchema, H as AStringEnumSchema, U as InferObjectRawType, M as MaybeNullable, E as NumberType, N as NumberTypeValues, P as PartialBy, B as Resolve, v as ResultFailure, u as ResultSuccess, y as SchemaMetadata, x as VALIDATOR_KEY, s as ValidationException, r as errorMessageFromErrors, F as isAAraySchema, L as isADiscriminatorSchema, T as isAObjectSchema, Q as isARecordSchema, Y as isARefSchema, D as isAScalarSchema, z as isASchema, J as isAStringEnumSchema, X as isObject, t as isValidationException, q as isValueError, w as newValidationContext } from './shared/schema.CGpRJ4kH.js';
3
+ import { A as ASchema, a as ASchemaStrict, I as InferType, R as Result, S as SchemaValidator, b as ASchemaOptions, c as ASchemaWithAdapters, d as AArraySchema, W as WithAdapters, e as AScalarSchemaWithAdapters, f as AObjectSchema, g as ADiscriminatorSchemaWithAdapters, h as ResolveObject, i as AStringEnumSchemaWithAdapters, j as AObjectSchemaWithAdapters, k as AObjectSchemaOptions, l as InferObjectOutput, V as ValidationContext, m as ARecordSchemaWithAdapters, n as ARefSchema, o as ValueError, p as InferSubType } from './shared/schema.hMebmI3A.js';
4
+ export { G as AArraySchemaWithAdapters, K as ADiscriminatorSchema, O as ARecordSchema, Z as ARefSchemaWithAdapters, C as AScalarSchema, H as AStringEnumSchema, U as InferObjectRawType, M as MaybeNullable, E as NumberType, N as NumberTypeValues, P as PartialBy, B as Resolve, v as ResultFailure, u as ResultSuccess, y as SchemaMetadata, x as VALIDATOR_KEY, s as ValidationException, r as errorMessageFromErrors, F as isAAraySchema, L as isADiscriminatorSchema, T as isAObjectSchema, Q as isARecordSchema, Y as isARefSchema, D as isAScalarSchema, z as isASchema, J as isAStringEnumSchema, X as isObject, t as isValidationException, q as isValueError, w as newValidationContext } from './shared/schema.hMebmI3A.js';
5
5
 
6
6
  declare function createParsingTemplate(input: string, schema: Schema, shouldCoerce?: boolean): string;
7
7
 
@@ -177,6 +177,23 @@ declare function nullable<T>(schema: ASchema<T>, opts?: ASchemaOptions): ASchema
177
177
  declare function optional<T>(input: ASchema<T>, opts?: ASchemaOptions): ASchema<T | undefined>;
178
178
  declare function clone<T>(input: ASchema<T>, opts?: ASchemaOptions): ASchemaWithAdapters<T>;
179
179
 
180
+ declare const int8Min = -128;
181
+ declare const int8Max = 127;
182
+ declare const uint8Min = 0;
183
+ declare const uint8Max = 255;
184
+ declare const int16Min = -32768;
185
+ declare const int16Max = 32767;
186
+ declare const uint16Min = 0;
187
+ declare const uint16Max = 65535;
188
+ declare const int32Min = -2147483648;
189
+ declare const int32Max = 2147483647;
190
+ declare const uint32Min = 0;
191
+ declare const uint32Max = 4294967295;
192
+ declare const int64Min: bigint;
193
+ declare const int64Max: bigint;
194
+ declare const uint64Min: bigint;
195
+ declare const uint64Max: bigint;
196
+
180
197
  /**
181
198
  * Alias for float64 as that is the only number type that Javascript uses
182
199
  *
@@ -386,24 +403,49 @@ declare const _namespace_uint64: typeof uint64;
386
403
  declare const _namespace_uint8: typeof uint8;
387
404
  declare const _namespace_validate: typeof validate;
388
405
  declare namespace _namespace {
389
- export { _namespace_any as any, _namespace_array as array, _namespace_boolean as boolean, _namespace_clone as clone, _namespace_coerce as coerce, _namespace_coerceUnsafe as coerceUnsafe, _namespace_compile as compile, _namespace_discriminator as discriminator, _namespace_enumerator as enumerator, _namespace_errors as errors, _namespace_extend as extend, _namespace_float32 as float32, _namespace_float64 as float64, InferType as infer, InferSubType as inferSubType, _namespace_int16 as int16, _namespace_int32 as int32, _namespace_int64 as int64, _namespace_int8 as int8, _namespace_nullable as nullable, _namespace_number as number, _namespace_object as object, _namespace_omit as omit, _namespace_optional as optional, _namespace_parse as parse, _namespace_parseUnsafe as parseUnsafe, _namespace_partial as partial, _namespace_pick as pick, _namespace_record as record, _namespace_recursive as recursive, _namespace_serialize as serialize, _namespace_serializeUnsafe as serializeUnsafe, _namespace_string as string, _namespace_stringEnum as stringEnum, _namespace_timestamp as timestamp, _namespace_uint16 as uint16, _namespace_uint32 as uint32, _namespace_uint64 as uint64, _namespace_uint8 as uint8, _namespace_validate as validate };
406
+ export {
407
+ _namespace_any as any,
408
+ _namespace_array as array,
409
+ _namespace_boolean as boolean,
410
+ _namespace_clone as clone,
411
+ _namespace_coerce as coerce,
412
+ _namespace_coerceUnsafe as coerceUnsafe,
413
+ _namespace_compile as compile,
414
+ _namespace_discriminator as discriminator,
415
+ _namespace_enumerator as enumerator,
416
+ _namespace_errors as errors,
417
+ _namespace_extend as extend,
418
+ _namespace_float32 as float32,
419
+ _namespace_float64 as float64,
420
+ InferType as infer,
421
+ InferSubType as inferSubType,
422
+ _namespace_int16 as int16,
423
+ _namespace_int32 as int32,
424
+ _namespace_int64 as int64,
425
+ _namespace_int8 as int8,
426
+ _namespace_nullable as nullable,
427
+ _namespace_number as number,
428
+ _namespace_object as object,
429
+ _namespace_omit as omit,
430
+ _namespace_optional as optional,
431
+ _namespace_parse as parse,
432
+ _namespace_parseUnsafe as parseUnsafe,
433
+ _namespace_partial as partial,
434
+ _namespace_pick as pick,
435
+ _namespace_record as record,
436
+ _namespace_recursive as recursive,
437
+ _namespace_serialize as serialize,
438
+ _namespace_serializeUnsafe as serializeUnsafe,
439
+ _namespace_string as string,
440
+ _namespace_stringEnum as stringEnum,
441
+ _namespace_timestamp as timestamp,
442
+ _namespace_uint16 as uint16,
443
+ _namespace_uint32 as uint32,
444
+ _namespace_uint64 as uint64,
445
+ _namespace_uint8 as uint8,
446
+ _namespace_validate as validate,
447
+ };
390
448
  }
391
449
 
392
- declare const int8Min = -128;
393
- declare const int8Max = 127;
394
- declare const uint8Min = 0;
395
- declare const uint8Max = 255;
396
- declare const int16Min = -32768;
397
- declare const int16Max = 32767;
398
- declare const uint16Min = 0;
399
- declare const uint16Max = 65535;
400
- declare const int32Min = -2147483648;
401
- declare const int32Max = 2147483647;
402
- declare const uint32Min = 0;
403
- declare const uint32Max = 4294967295;
404
- declare const int64Min: bigint;
405
- declare const int64Max: bigint;
406
- declare const uint64Min: bigint;
407
- declare const uint64Max: bigint;
408
-
409
- export { AArraySchema, ADiscriminatorSchemaWithAdapters, AObjectSchema, AObjectSchemaOptions, AObjectSchemaWithAdapters, ARecordSchemaWithAdapters, ARefSchema, AScalarSchemaWithAdapters, ASchema, ASchemaOptions, ASchemaStrict, ASchemaWithAdapters, AStringEnumSchemaWithAdapters, type CompiledValidator, type CompiledValidatorCompiledCode, InferObjectOutput, InferSubType, InferType, ResolveObject, Result, STR_ESCAPE, SchemaValidator, ValidationContext, ValueError, WithAdapters, _namespace as a, any, array, boolean, clone, coerce, coerceUnsafe, compile, decodeObjectSchema, discriminator, enumerator, errors, extend, float32, float64, getCompiledParser, getCompiledSerializer, createParsingTemplate as getSchemaDecodingCode, createSerializationV2Template as getSchemaSerializationCode, createValidationTemplate as getSchemaValidationCode, int16, int16Max, int16Min, int32, int32Max, int32Min, int64, int64Max, int64Min, int8, int8Max, int8Min, nullable, number, object, omit, optional, parse, parseUnsafe, partial, pick, record, recursive, sanitizeJson, serialize, serializeObject, serializeSmallString, serializeString, serializeUnsafe, string, stringEnum, timestamp, uint16, uint16Max, uint16Min, uint32, uint32Max, uint32Min, uint64, uint64Max, uint64Min, uint8, uint8Max, uint8Min, validate, validateObjectSchema };
450
+ export { AArraySchema, ADiscriminatorSchemaWithAdapters, AObjectSchema, AObjectSchemaOptions, AObjectSchemaWithAdapters, ARecordSchemaWithAdapters, ARefSchema, AScalarSchemaWithAdapters, ASchema, ASchemaOptions, ASchemaStrict, ASchemaWithAdapters, AStringEnumSchemaWithAdapters, InferObjectOutput, InferSubType, InferType, ResolveObject, Result, STR_ESCAPE, SchemaValidator, ValidationContext, ValueError, WithAdapters, _namespace as a, any, array, boolean, clone, coerce, coerceUnsafe, compile, decodeObjectSchema, discriminator, enumerator, errors, extend, float32, float64, getCompiledParser, getCompiledSerializer, createParsingTemplate as getSchemaDecodingCode, createSerializationV2Template as getSchemaSerializationCode, createValidationTemplate as getSchemaValidationCode, int16, int16Max, int16Min, int32, int32Max, int32Min, int64, int64Max, int64Min, int8, int8Max, int8Min, nullable, number, object, omit, optional, parse, parseUnsafe, partial, pick, record, recursive, sanitizeJson, serialize, serializeObject, serializeSmallString, serializeString, serializeUnsafe, string, stringEnum, timestamp, uint16, uint16Max, uint16Min, uint32, uint32Max, uint32Min, uint64, uint64Max, uint64Min, uint8, uint8Max, uint8Min, validate, validateObjectSchema };
451
+ export type { CompiledValidator, CompiledValidatorCompiledCode };
@@ -169,4 +169,5 @@ interface ARefSchema<T> extends ASchema<T> {
169
169
  declare function isARefSchema(input: unknown): input is ARefSchema<any>;
170
170
  type ARefSchemaWithAdapters<T> = ARefSchema<T> & WithAdapters<T>;
171
171
 
172
- export { type ASchema as A, type Resolve as B, type AScalarSchema as C, isAScalarSchema as D, type NumberType as E, isAAraySchema as F, type AArraySchemaWithAdapters as G, type AStringEnumSchema as H, type InferType as I, isAStringEnumSchema as J, type ADiscriminatorSchema as K, isADiscriminatorSchema as L, type MaybeNullable as M, NumberTypeValues as N, type ARecordSchema as O, type PartialBy as P, isARecordSchema as Q, type Result as R, type SchemaValidator as S, isAObjectSchema as T, type InferObjectRawType as U, type ValidationContext as V, type WithAdapters as W, isObject as X, isARefSchema as Y, type ARefSchemaWithAdapters as Z, type ASchemaStrict as a, type ASchemaOptions as b, type ASchemaWithAdapters as c, type AArraySchema as d, type AScalarSchemaWithAdapters as e, type AObjectSchema as f, type ADiscriminatorSchemaWithAdapters as g, type ResolveObject as h, type AStringEnumSchemaWithAdapters as i, type AObjectSchemaWithAdapters as j, type AObjectSchemaOptions as k, type InferObjectOutput as l, type ARecordSchemaWithAdapters as m, type ARefSchema as n, type ValueError as o, type InferSubType as p, isValueError as q, errorMessageFromErrors as r, ValidationException as s, isValidationException as t, type ResultSuccess as u, type ResultFailure as v, newValidationContext as w, VALIDATOR_KEY as x, type SchemaMetadata as y, isASchema as z };
172
+ export { isAScalarSchema as D, isAAraySchema as F, isAStringEnumSchema as J, isADiscriminatorSchema as L, NumberTypeValues as N, isARecordSchema as Q, isAObjectSchema as T, isObject as X, isARefSchema as Y, isValueError as q, errorMessageFromErrors as r, ValidationException as s, isValidationException as t, newValidationContext as w, VALIDATOR_KEY as x, isASchema as z };
173
+ export type { ASchema as A, Resolve as B, AScalarSchema as C, NumberType as E, AArraySchemaWithAdapters as G, AStringEnumSchema as H, InferType as I, ADiscriminatorSchema as K, MaybeNullable as M, ARecordSchema as O, PartialBy as P, Result as R, SchemaValidator as S, InferObjectRawType as U, ValidationContext as V, WithAdapters as W, ARefSchemaWithAdapters as Z, ASchemaStrict as a, ASchemaOptions as b, ASchemaWithAdapters as c, AArraySchema as d, AScalarSchemaWithAdapters as e, AObjectSchema as f, ADiscriminatorSchemaWithAdapters as g, ResolveObject as h, AStringEnumSchemaWithAdapters as i, AObjectSchemaWithAdapters as j, AObjectSchemaOptions as k, InferObjectOutput as l, ARecordSchemaWithAdapters as m, ARefSchema as n, ValueError as o, InferSubType as p, ResultSuccess as u, ResultFailure as v, SchemaMetadata as y };
@@ -169,4 +169,5 @@ interface ARefSchema<T> extends ASchema<T> {
169
169
  declare function isARefSchema(input: unknown): input is ARefSchema<any>;
170
170
  type ARefSchemaWithAdapters<T> = ARefSchema<T> & WithAdapters<T>;
171
171
 
172
- export { type ASchema as A, type Resolve as B, type AScalarSchema as C, isAScalarSchema as D, type NumberType as E, isAAraySchema as F, type AArraySchemaWithAdapters as G, type AStringEnumSchema as H, type InferType as I, isAStringEnumSchema as J, type ADiscriminatorSchema as K, isADiscriminatorSchema as L, type MaybeNullable as M, NumberTypeValues as N, type ARecordSchema as O, type PartialBy as P, isARecordSchema as Q, type Result as R, type SchemaValidator as S, isAObjectSchema as T, type InferObjectRawType as U, type ValidationContext as V, type WithAdapters as W, isObject as X, isARefSchema as Y, type ARefSchemaWithAdapters as Z, type ASchemaStrict as a, type ASchemaOptions as b, type ASchemaWithAdapters as c, type AArraySchema as d, type AScalarSchemaWithAdapters as e, type AObjectSchema as f, type ADiscriminatorSchemaWithAdapters as g, type ResolveObject as h, type AStringEnumSchemaWithAdapters as i, type AObjectSchemaWithAdapters as j, type AObjectSchemaOptions as k, type InferObjectOutput as l, type ARecordSchemaWithAdapters as m, type ARefSchema as n, type ValueError as o, type InferSubType as p, isValueError as q, errorMessageFromErrors as r, ValidationException as s, isValidationException as t, type ResultSuccess as u, type ResultFailure as v, newValidationContext as w, VALIDATOR_KEY as x, type SchemaMetadata as y, isASchema as z };
172
+ export { isAScalarSchema as D, isAAraySchema as F, isAStringEnumSchema as J, isADiscriminatorSchema as L, NumberTypeValues as N, isARecordSchema as Q, isAObjectSchema as T, isObject as X, isARefSchema as Y, isValueError as q, errorMessageFromErrors as r, ValidationException as s, isValidationException as t, newValidationContext as w, VALIDATOR_KEY as x, isASchema as z };
173
+ export type { ASchema as A, Resolve as B, AScalarSchema as C, NumberType as E, AArraySchemaWithAdapters as G, AStringEnumSchema as H, InferType as I, ADiscriminatorSchema as K, MaybeNullable as M, ARecordSchema as O, PartialBy as P, Result as R, SchemaValidator as S, InferObjectRawType as U, ValidationContext as V, WithAdapters as W, ARefSchemaWithAdapters as Z, ASchemaStrict as a, ASchemaOptions as b, ASchemaWithAdapters as c, AArraySchema as d, AScalarSchemaWithAdapters as e, AObjectSchema as f, ADiscriminatorSchemaWithAdapters as g, ResolveObject as h, AStringEnumSchemaWithAdapters as i, AObjectSchemaWithAdapters as j, AObjectSchemaOptions as k, InferObjectOutput as l, ARecordSchemaWithAdapters as m, ARefSchema as n, ValueError as o, InferSubType as p, ResultSuccess as u, ResultFailure as v, SchemaMetadata as y };
@@ -169,4 +169,5 @@ interface ARefSchema<T> extends ASchema<T> {
169
169
  declare function isARefSchema(input: unknown): input is ARefSchema<any>;
170
170
  type ARefSchemaWithAdapters<T> = ARefSchema<T> & WithAdapters<T>;
171
171
 
172
- export { type ASchema as A, type Resolve as B, type AScalarSchema as C, isAScalarSchema as D, type NumberType as E, isAAraySchema as F, type AArraySchemaWithAdapters as G, type AStringEnumSchema as H, type InferType as I, isAStringEnumSchema as J, type ADiscriminatorSchema as K, isADiscriminatorSchema as L, type MaybeNullable as M, NumberTypeValues as N, type ARecordSchema as O, type PartialBy as P, isARecordSchema as Q, type Result as R, type SchemaValidator as S, isAObjectSchema as T, type InferObjectRawType as U, type ValidationContext as V, type WithAdapters as W, isObject as X, isARefSchema as Y, type ARefSchemaWithAdapters as Z, type ASchemaStrict as a, type ASchemaOptions as b, type ASchemaWithAdapters as c, type AArraySchema as d, type AScalarSchemaWithAdapters as e, type AObjectSchema as f, type ADiscriminatorSchemaWithAdapters as g, type ResolveObject as h, type AStringEnumSchemaWithAdapters as i, type AObjectSchemaWithAdapters as j, type AObjectSchemaOptions as k, type InferObjectOutput as l, type ARecordSchemaWithAdapters as m, type ARefSchema as n, type ValueError as o, type InferSubType as p, isValueError as q, errorMessageFromErrors as r, ValidationException as s, isValidationException as t, type ResultSuccess as u, type ResultFailure as v, newValidationContext as w, VALIDATOR_KEY as x, type SchemaMetadata as y, isASchema as z };
172
+ export { isAScalarSchema as D, isAAraySchema as F, isAStringEnumSchema as J, isADiscriminatorSchema as L, NumberTypeValues as N, isARecordSchema as Q, isAObjectSchema as T, isObject as X, isARefSchema as Y, isValueError as q, errorMessageFromErrors as r, ValidationException as s, isValidationException as t, newValidationContext as w, VALIDATOR_KEY as x, isASchema as z };
173
+ export type { ASchema as A, Resolve as B, AScalarSchema as C, NumberType as E, AArraySchemaWithAdapters as G, AStringEnumSchema as H, InferType as I, ADiscriminatorSchema as K, MaybeNullable as M, ARecordSchema as O, PartialBy as P, Result as R, SchemaValidator as S, InferObjectRawType as U, ValidationContext as V, WithAdapters as W, ARefSchemaWithAdapters as Z, ASchemaStrict as a, ASchemaOptions as b, ASchemaWithAdapters as c, AArraySchema as d, AScalarSchemaWithAdapters as e, AObjectSchema as f, ADiscriminatorSchemaWithAdapters as g, ResolveObject as h, AStringEnumSchemaWithAdapters as i, AObjectSchemaWithAdapters as j, AObjectSchemaOptions as k, InferObjectOutput as l, ARecordSchemaWithAdapters as m, ARefSchema as n, ValueError as o, InferSubType as p, ResultSuccess as u, ResultFailure as v, SchemaMetadata as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/schema",
3
- "version": "0.76.4",
3
+ "version": "0.77.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -25,10 +25,16 @@
25
25
  "@standard-schema/spec": "1.0.0",
26
26
  "scule": "^1.3.0",
27
27
  "uncrypto": "^0.1.3",
28
- "@arrirpc/type-defs": "0.76.4"
28
+ "@arrirpc/type-defs": "0.77.0"
29
29
  },
30
30
  "devDependencies": {
31
+ "@ryoppippi/unplugin-typia": "^2.1.3",
32
+ "@sinclair/typebox": "^0.34.31",
31
33
  "ajv": "^8.17.1",
32
- "benny": "^3.7.1"
34
+ "arktype": "^2.1.12",
35
+ "benny": "^3.7.1",
36
+ "typia": "^8.0.3",
37
+ "valibot": "1.0.0",
38
+ "zod": "^3.24.2"
33
39
  }
34
40
  }