@awsless/validate 0.0.22 → 0.0.23

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/dist/index.cjs CHANGED
@@ -22,8 +22,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
22
  var index_exports = {};
23
23
  __export(index_exports, {
24
24
  bigfloat: () => bigfloat,
25
- bigint: () => bigint2,
26
- date: () => date,
27
25
  duration: () => duration,
28
26
  dynamoDbStream: () => dynamoDbStream,
29
27
  json: () => json,
@@ -42,16 +40,21 @@ __reExport(index_exports, require("valibot"), module.exports);
42
40
  // src/schema/json.ts
43
41
  var import_json = require("@awsless/json");
44
42
  var import_valibot = require("valibot");
45
- var json = (schema) => {
46
- return (0, import_valibot.transform)(
47
- (0, import_valibot.string)(),
48
- (value) => {
43
+ var json = (schema, message = "Invalid JSON") => {
44
+ return (0, import_valibot.pipe)(
45
+ (0, import_valibot.string)(message),
46
+ (0, import_valibot.rawTransform)((ctx) => {
47
+ let result;
49
48
  try {
50
- return (0, import_json.parse)(value);
51
- } catch (error) {
52
- return null;
49
+ result = (0, import_json.parse)(ctx.dataset.value);
50
+ } catch (_error) {
51
+ ctx.addIssue({
52
+ message
53
+ });
54
+ return ctx.NEVER;
53
55
  }
54
- },
56
+ return result;
57
+ }),
55
58
  schema
56
59
  );
57
60
  };
@@ -59,160 +62,125 @@ var json = (schema) => {
59
62
  // src/schema/bigfloat.ts
60
63
  var import_big_float = require("@awsless/big-float");
61
64
  var import_valibot2 = require("valibot");
62
- var make = (value) => new import_big_float.BigFloat(value);
63
- function bigfloat(arg1, arg2) {
64
- const [msg, pipe] = (0, import_valibot2.defaultArgs)(arg1, arg2);
65
- const error = msg ?? "Invalid bigfloat";
65
+ function bigfloat(message = "Invalid bigfloat") {
66
66
  return (0, import_valibot2.union)(
67
67
  [
68
- (0, import_valibot2.instance)(import_big_float.BigFloat, pipe),
69
- (0, import_valibot2.transform)((0, import_valibot2.string)([(0, import_valibot2.custom)((input) => input !== "" && !isNaN(Number(input)), error)]), make, pipe),
70
- (0, import_valibot2.transform)((0, import_valibot2.number)(), make, pipe),
71
- (0, import_valibot2.transform)(
72
- (0, import_valibot2.object)({
73
- exponent: (0, import_valibot2.number)(),
74
- coefficient: (0, import_valibot2.bigint)()
75
- }),
76
- make,
77
- pipe
78
- )
79
- ],
80
- error
81
- );
82
- }
83
-
84
- // src/schema/bigint.ts
85
- var import_valibot3 = require("valibot");
86
- function bigint2(arg1, arg2) {
87
- const [error, pipe] = (0, import_valibot3.defaultArgs)(arg1, arg2);
88
- return (0, import_valibot3.union)(
89
- [
90
- (0, import_valibot3.bigint)(pipe),
91
- (0, import_valibot3.transform)(
92
- (0, import_valibot3.string)([(0, import_valibot3.regex)(/^-?[0-9]+$/)]),
93
- (input) => {
94
- return BigInt(input);
95
- },
96
- (0, import_valibot3.bigint)(pipe)
97
- )
98
- ],
99
- error ?? "Invalid BigInt"
100
- );
101
- }
102
-
103
- // src/schema/date.ts
104
- var import_valibot4 = require("valibot");
105
- function date(arg1, arg2) {
106
- const [error, pipe] = (0, import_valibot4.defaultArgs)(arg1, arg2);
107
- return (0, import_valibot4.union)(
108
- [
109
- (0, import_valibot4.date)(pipe),
110
- (0, import_valibot4.transform)(
111
- (0, import_valibot4.string)(),
112
- (input) => {
113
- return new Date(input);
114
- },
115
- (0, import_valibot4.date)(pipe)
68
+ (0, import_valibot2.instance)(import_big_float.BigFloat),
69
+ (0, import_valibot2.pipe)(
70
+ (0, import_valibot2.string)(),
71
+ (0, import_valibot2.decimal)(),
72
+ (0, import_valibot2.transform)((v) => (0, import_big_float.parse)(v))
73
+ ),
74
+ (0, import_valibot2.pipe)(
75
+ (0, import_valibot2.bigint)(),
76
+ (0, import_valibot2.transform)((v) => (0, import_big_float.parse)(v))
77
+ ),
78
+ (0, import_valibot2.pipe)(
79
+ (0, import_valibot2.number)(),
80
+ (0, import_valibot2.transform)((v) => (0, import_big_float.parse)(v))
116
81
  )
117
82
  ],
118
- error ?? "Invalid date"
83
+ message
119
84
  );
120
85
  }
121
86
 
122
87
  // src/schema/uuid.ts
123
- var import_valibot5 = require("valibot");
124
- var uuid = (error) => {
125
- return (0, import_valibot5.string)(error ?? "Invalid UUID", [(0, import_valibot5.uuid)()]);
88
+ var import_valibot3 = require("valibot");
89
+ var uuid = (message = "Invalid UUID") => {
90
+ return (0, import_valibot3.pipe)((0, import_valibot3.string)(message), (0, import_valibot3.uuid)(message));
126
91
  };
127
92
 
128
93
  // src/schema/duration.ts
129
94
  var import_duration = require("@awsless/duration");
130
- var import_valibot6 = require("valibot");
131
- function duration(arg1, arg2) {
132
- const [msg, pipe] = (0, import_valibot6.defaultArgs)(arg1, arg2);
133
- const error = msg ?? "Invalid duration";
134
- return (0, import_valibot6.instance)(import_duration.Duration, error, pipe);
95
+ var import_valibot4 = require("valibot");
96
+ function duration(message = "Invalid duration") {
97
+ return (0, import_valibot4.instance)(import_duration.Duration, message);
135
98
  }
136
99
 
137
100
  // src/schema/aws/sqs-queue.ts
138
- var import_valibot7 = require("valibot");
139
- var sqsQueue = (body) => {
140
- const schema = body ?? (0, import_valibot7.unknown)();
141
- return (0, import_valibot7.union)(
101
+ var import_valibot5 = require("valibot");
102
+ var sqsQueue = (schema, message = "Invalid SQS Queue payload") => {
103
+ return (0, import_valibot5.union)(
142
104
  [
143
- (0, import_valibot7.transform)(schema, (input) => [input]),
144
- (0, import_valibot7.array)(schema),
145
- (0, import_valibot7.transform)(
146
- (0, import_valibot7.object)({
147
- Records: (0, import_valibot7.array)(
148
- (0, import_valibot7.object)({
105
+ // Prioritize the expected payload during production
106
+ (0, import_valibot5.pipe)(
107
+ (0, import_valibot5.object)({
108
+ Records: (0, import_valibot5.array)(
109
+ (0, import_valibot5.object)({
149
110
  body: json(schema)
150
111
  })
151
112
  )
152
113
  }),
153
- (input) => input.Records.map((record) => {
154
- return record.body;
155
- })
156
- )
114
+ (0, import_valibot5.transform)((v) => v.Records.map((r) => r.body))
115
+ ),
116
+ // These are allowed during testing
117
+ (0, import_valibot5.pipe)(
118
+ schema,
119
+ (0, import_valibot5.transform)((v) => [v])
120
+ ),
121
+ (0, import_valibot5.array)(schema)
157
122
  ],
158
- "Invalid SQS Queue input"
123
+ message
159
124
  );
160
125
  };
161
126
 
162
127
  // src/schema/aws/sns-topic.ts
163
- var import_valibot8 = require("valibot");
164
- var snsTopic = (body) => {
165
- const schema = body ?? (0, import_valibot8.unknown)();
166
- return (0, import_valibot8.union)(
128
+ var import_valibot6 = require("valibot");
129
+ var snsTopic = (schema, message = "Invalid SNS Topic payload") => {
130
+ return (0, import_valibot6.union)(
167
131
  [
168
- (0, import_valibot8.transform)(schema, (input) => [input]),
169
- (0, import_valibot8.array)(schema),
170
- (0, import_valibot8.transform)(
171
- (0, import_valibot8.object)({
172
- Records: (0, import_valibot8.array)(
173
- (0, import_valibot8.object)({
174
- Sns: (0, import_valibot8.object)({
132
+ (0, import_valibot6.pipe)(
133
+ schema,
134
+ (0, import_valibot6.transform)((v) => [v])
135
+ ),
136
+ (0, import_valibot6.array)(schema),
137
+ (0, import_valibot6.pipe)(
138
+ (0, import_valibot6.object)({
139
+ Records: (0, import_valibot6.array)(
140
+ (0, import_valibot6.object)({
141
+ Sns: (0, import_valibot6.object)({
175
142
  Message: json(schema)
176
143
  })
177
144
  })
178
145
  )
179
146
  }),
180
- (input) => input.Records.map((record) => {
181
- return record.Sns.Message;
182
- })
147
+ (0, import_valibot6.transform)((v) => v.Records.map((r) => r.Sns.Message))
183
148
  )
184
149
  ],
185
- "Invalid SNS Topic input"
150
+ message
186
151
  );
187
152
  };
188
153
 
189
154
  // src/schema/aws/dynamodb-stream.ts
190
- var import_valibot9 = require("valibot");
191
- var dynamoDbStream = (table) => {
192
- const unmarshall = () => (0, import_valibot9.transform)((0, import_valibot9.unknown)(), (value) => table.unmarshall(value));
193
- return (0, import_valibot9.transform)(
194
- (0, import_valibot9.object)(
155
+ var import_valibot7 = require("valibot");
156
+ var dynamoDbStream = (table, message = "Invalid DynamoDB Stream payload") => {
157
+ const unmarshall = () => (0, import_valibot7.pipe)(
158
+ (0, import_valibot7.unknown)(),
159
+ (0, import_valibot7.transform)((v) => table.unmarshall(v))
160
+ );
161
+ return (0, import_valibot7.pipe)(
162
+ (0, import_valibot7.object)(
195
163
  {
196
- Records: (0, import_valibot9.array)(
197
- (0, import_valibot9.variant)("eventName", [
198
- (0, import_valibot9.object)({
199
- eventName: (0, import_valibot9.literal)("MODIFY"),
200
- dynamodb: (0, import_valibot9.object)({
164
+ Records: (0, import_valibot7.array)(
165
+ (0, import_valibot7.variant)("eventName", [
166
+ (0, import_valibot7.object)({
167
+ eventName: (0, import_valibot7.literal)("MODIFY"),
168
+ dynamodb: (0, import_valibot7.object)({
201
169
  Keys: unmarshall(),
202
170
  OldImage: unmarshall(),
203
171
  NewImage: unmarshall()
204
172
  })
205
173
  }),
206
- (0, import_valibot9.object)({
207
- eventName: (0, import_valibot9.literal)("INSERT"),
208
- dynamodb: (0, import_valibot9.object)({
174
+ (0, import_valibot7.object)({
175
+ eventName: (0, import_valibot7.literal)("INSERT"),
176
+ dynamodb: (0, import_valibot7.object)({
209
177
  Keys: unmarshall(),
210
178
  NewImage: unmarshall()
211
179
  })
212
180
  }),
213
- (0, import_valibot9.object)({
214
- eventName: (0, import_valibot9.literal)("REMOVE"),
215
- dynamodb: (0, import_valibot9.object)({
181
+ (0, import_valibot7.object)({
182
+ eventName: (0, import_valibot7.literal)("REMOVE"),
183
+ dynamodb: (0, import_valibot7.object)({
216
184
  Keys: unmarshall(),
217
185
  OldImage: unmarshall()
218
186
  })
@@ -220,9 +188,9 @@ var dynamoDbStream = (table) => {
220
188
  ])
221
189
  )
222
190
  },
223
- "Invalid DynamoDB Stream input"
191
+ message
224
192
  ),
225
- (input) => {
193
+ (0, import_valibot7.transform)((input) => {
226
194
  return input.Records.map((record) => {
227
195
  const item = {
228
196
  event: record.eventName.toLowerCase(),
@@ -236,34 +204,31 @@ var dynamoDbStream = (table) => {
236
204
  }
237
205
  return item;
238
206
  });
239
- }
207
+ })
240
208
  );
241
209
  };
242
210
 
243
211
  // src/validation/positive.ts
244
212
  var import_big_float2 = require("@awsless/big-float");
245
- var import_valibot10 = require("valibot");
246
- function positive(error) {
247
- return (0, import_valibot10.custom)((input) => (0, import_big_float2.gt)(input, import_big_float2.ZERO), error ?? "Invalid positive number");
213
+ var import_valibot8 = require("valibot");
214
+ function positive(message = "Invalid positive number") {
215
+ return (0, import_valibot8.check)((input) => (0, import_big_float2.isPositive)(input), message);
248
216
  }
249
217
 
250
218
  // src/validation/precision.ts
251
219
  var import_big_float3 = require("@awsless/big-float");
252
- var import_valibot11 = require("valibot");
253
- function precision(decimals, error) {
254
- return (0, import_valibot11.custom)(
255
- (input) => {
256
- const big = (0, import_big_float3.parse)(input.toString());
257
- return -big.exponent <= decimals;
258
- },
259
- error ?? `Invalid ${decimals} precision number`
260
- );
220
+ var import_valibot9 = require("valibot");
221
+ function precision(decimals, message = `Invalid ${decimals} precision number`) {
222
+ return (0, import_valibot9.check)((input) => {
223
+ const big = (0, import_big_float3.parse)(input.toString());
224
+ return -big.exponent <= decimals;
225
+ }, message);
261
226
  }
262
227
 
263
228
  // src/validation/unique.ts
264
- var import_valibot12 = require("valibot");
265
- function unique(compare = (a, b) => a === b, error) {
266
- return (0, import_valibot12.custom)((input) => {
229
+ var import_valibot10 = require("valibot");
230
+ function unique(compare = (a, b) => a === b, message = "None unique array") {
231
+ return (0, import_valibot10.check)((input) => {
267
232
  for (const x in input) {
268
233
  for (const y in input) {
269
234
  if (x !== y && compare(input[x], input[y])) {
@@ -272,22 +237,20 @@ function unique(compare = (a, b) => a === b, error) {
272
237
  }
273
238
  }
274
239
  return true;
275
- }, error ?? "None unique array");
240
+ }, message);
276
241
  }
277
242
 
278
243
  // src/validation/duration.ts
279
- var import_valibot13 = require("valibot");
280
- function minDuration(min, error) {
281
- return (0, import_valibot13.custom)((input) => input.value >= min.value, error ?? "Invalid duration");
244
+ var import_valibot11 = require("valibot");
245
+ function minDuration(min, message = "Invalid duration") {
246
+ return (0, import_valibot11.check)((input) => input.value >= min.value, message);
282
247
  }
283
- function maxDuration(max, error) {
284
- return (0, import_valibot13.custom)((input) => input.value <= max.value, error ?? "Invalid duration");
248
+ function maxDuration(max, message = "Invalid duration") {
249
+ return (0, import_valibot11.check)((input) => input.value <= max.value, message);
285
250
  }
286
251
  // Annotate the CommonJS export names for ESM import in node:
287
252
  0 && (module.exports = {
288
253
  bigfloat,
289
- bigint,
290
- date,
291
254
  duration,
292
255
  dynamoDbStream,
293
256
  json,
package/dist/index.d.cts CHANGED
@@ -1,74 +1,69 @@
1
1
  import * as valibot from 'valibot';
2
- import { BaseSchema, SchemaWithTransform, StringSchema, Output, Pipe, ErrorMessage, UnknownSchema, Input } from 'valibot';
2
+ import { BaseSchema, BaseIssue, ErrorMessage, InferOutput, InstanceIssue, InferInput, CheckIssue } from 'valibot';
3
3
  export * from 'valibot';
4
4
  import { BigFloat } from '@awsless/big-float';
5
5
  import { UUID } from 'crypto';
6
- import { Duration, DurationFormat } from '@awsless/duration';
6
+ import { Duration } from '@awsless/duration';
7
7
  import { AnyTable, PrimaryKey, Infer } from '@awsless/dynamodb';
8
8
 
9
- type JsonSchema<T extends BaseSchema> = SchemaWithTransform<StringSchema, Output<T>>;
10
- declare const json: <T extends BaseSchema>(schema: T) => JsonSchema<T>;
9
+ type Schema$2 = BaseSchema<unknown, unknown, BaseIssue<unknown>>;
10
+ type JsonIssue = BaseIssue<unknown>;
11
+ type JsonSchema<T extends Schema$2> = BaseSchema<string, InferOutput<T>, JsonIssue>;
12
+ declare const json: <T extends Schema$2>(schema: T, message?: ErrorMessage<JsonIssue>) => JsonSchema<T>;
11
13
 
12
- type BigFloatSchema = BaseSchema<string | number | BigFloat | {
13
- exponent: number;
14
- coefficient: bigint;
15
- }, BigFloat>;
16
- declare function bigfloat(pipe?: Pipe<BigFloat>): BigFloatSchema;
17
- declare function bigfloat(error?: ErrorMessage, pipe?: Pipe<BigFloat>): BigFloatSchema;
14
+ type BigFloatIssue = BaseIssue<unknown>;
15
+ type BigFloatSchema = BaseSchema<BigFloat | string | bigint | number, BigFloat, BigFloatIssue>;
16
+ declare function bigfloat(message?: ErrorMessage<BigFloatIssue>): BigFloatSchema;
18
17
 
19
- type BigIntSchema = BaseSchema<string | bigint, bigint>;
20
- declare function bigint(pipe?: Pipe<bigint>): BigIntSchema;
21
- declare function bigint(error?: ErrorMessage, pipe?: Pipe<bigint>): BigIntSchema;
18
+ type UuidIssue = BaseIssue<unknown>;
19
+ type UuidSchema = BaseSchema<UUID, UUID, UuidIssue>;
20
+ declare const uuid: (message?: ErrorMessage<UuidIssue>) => UuidSchema;
22
21
 
23
- type DateSchema = BaseSchema<string | Date, Date>;
24
- declare function date(pipe?: Pipe<Date>): DateSchema;
25
- declare function date(error?: ErrorMessage, pipe?: Pipe<Date>): DateSchema;
22
+ type DurationIssue = InstanceIssue;
23
+ type DurationSchema = BaseSchema<Duration, Duration, DurationIssue>;
24
+ declare function duration(message?: ErrorMessage<DurationIssue>): DurationSchema;
26
25
 
27
- type UuidSchema = BaseSchema<UUID, UUID>;
28
- declare const uuid: (error?: ErrorMessage) => UuidSchema;
29
-
30
- type DurationSchema = BaseSchema<DurationFormat | Duration, Duration>;
31
- declare function duration(pipe?: Pipe<Duration>): DurationSchema;
32
- declare function duration(error?: ErrorMessage, pipe?: Pipe<Duration>): DurationSchema;
33
-
34
- type SqsQueueSchema<S extends BaseSchema = UnknownSchema> = BaseSchema<Input<S> | Input<S>[] | {
26
+ type Schema$1 = BaseSchema<unknown, unknown, BaseIssue<unknown>>;
27
+ type SqsQueueIssue = BaseIssue<unknown>;
28
+ type SqsQueueSchema<S extends Schema$1> = BaseSchema<InferInput<S> | InferInput<S>[] | {
35
29
  Records: {
36
- body: string | Input<S>;
30
+ body: string | InferInput<S>;
37
31
  }[];
38
- }, Output<S>[]>;
39
- declare const sqsQueue: <S extends BaseSchema = UnknownSchema>(body?: S) => SqsQueueSchema<S>;
32
+ }, InferOutput<S>[], SqsQueueIssue>;
33
+ declare const sqsQueue: <S extends Schema$1>(schema: S, message?: ErrorMessage<SqsQueueIssue>) => SqsQueueSchema<S>;
40
34
 
41
- type SnsTopicSchema<S extends BaseSchema = UnknownSchema> = BaseSchema<Input<S> | Input<S>[] | {
35
+ type Schema = BaseSchema<unknown, unknown, BaseIssue<unknown>>;
36
+ type SnsTopicIssue = BaseIssue<unknown>;
37
+ type SnsTopicSchema<S extends Schema> = BaseSchema<InferInput<S> | InferInput<S>[] | {
42
38
  Records: {
43
39
  Sns: {
44
- Message: string | Input<S>;
40
+ Message: string | InferInput<S>;
45
41
  };
46
42
  }[];
47
- }, Output<S>[]>;
48
- declare const snsTopic: <S extends BaseSchema = UnknownSchema>(body?: S) => SnsTopicSchema<S>;
43
+ }, InferOutput<S>[], SnsTopicIssue>;
44
+ declare const snsTopic: <S extends Schema>(schema: S, message?: ErrorMessage<SnsTopicIssue>) => SnsTopicSchema<S>;
49
45
 
50
- type DynamoDBStreamSchema<T extends AnyTable> = BaseSchema<{
51
- Records: Array<{
52
- eventName: 'MODIFY';
53
- dynamodb: {
54
- Keys: unknown;
55
- OldImage: unknown;
56
- NewImage: unknown;
57
- };
58
- } | {
59
- eventName: 'INSERT';
60
- dynamodb: {
61
- Keys: unknown;
62
- NewImage: unknown;
63
- };
64
- } | {
65
- eventName: 'REMOVE';
66
- dynamodb: {
67
- Keys: unknown;
68
- OldImage: unknown;
69
- };
70
- }>;
71
- }, Array<{
46
+ type DynamoDBStreamInputRecord = {
47
+ eventName: 'MODIFY';
48
+ dynamodb: {
49
+ Keys: unknown;
50
+ OldImage: unknown;
51
+ NewImage: unknown;
52
+ };
53
+ } | {
54
+ eventName: 'INSERT';
55
+ dynamodb: {
56
+ Keys: unknown;
57
+ NewImage: unknown;
58
+ };
59
+ } | {
60
+ eventName: 'REMOVE';
61
+ dynamodb: {
62
+ Keys: unknown;
63
+ OldImage: unknown;
64
+ };
65
+ };
66
+ type DynamoDBStreamOutputRecord<T extends AnyTable> = {
72
67
  event: 'modify';
73
68
  keys: PrimaryKey<T>;
74
69
  old: Infer<T>;
@@ -81,16 +76,20 @@ type DynamoDBStreamSchema<T extends AnyTable> = BaseSchema<{
81
76
  event: 'remove';
82
77
  keys: PrimaryKey<T>;
83
78
  old: Infer<T>;
84
- }>>;
85
- declare const dynamoDbStream: <T extends AnyTable>(table: T) => DynamoDBStreamSchema<T>;
79
+ };
80
+ type DynamoDBStreamIssue = BaseIssue<unknown>;
81
+ type DynamoDBStreamSchema<T extends AnyTable> = BaseSchema<{
82
+ Records: DynamoDBStreamInputRecord[];
83
+ }, DynamoDBStreamOutputRecord<T>[], DynamoDBStreamIssue>;
84
+ declare const dynamoDbStream: <T extends AnyTable>(table: T, message?: ErrorMessage<DynamoDBStreamIssue>) => DynamoDBStreamSchema<T>;
86
85
 
87
- declare function positive<T extends BigFloat | number>(error?: ErrorMessage): valibot.CustomValidation<T>;
86
+ declare function positive<T extends BigFloat | number>(message?: ErrorMessage<CheckIssue<T>>): valibot.CheckAction<T, ErrorMessage<CheckIssue<T>>>;
88
87
 
89
- declare function precision<T extends BigFloat | number>(decimals: number, error?: ErrorMessage): valibot.CustomValidation<T>;
88
+ declare function precision<T extends BigFloat | number>(decimals: number, message?: ErrorMessage<CheckIssue<T>>): valibot.CheckAction<T, ErrorMessage<CheckIssue<T>>>;
90
89
 
91
- declare function unique<T extends any[]>(compare?: (a: T[number], b: T[number]) => boolean, error?: ErrorMessage): valibot.CustomValidation<T>;
90
+ declare function unique<T extends any[]>(compare?: (a: T[number], b: T[number]) => boolean, message?: ErrorMessage<CheckIssue<T>>): valibot.CheckAction<T, ErrorMessage<CheckIssue<T>>>;
92
91
 
93
- declare function minDuration<T extends Duration>(min: Duration, error?: ErrorMessage): valibot.CustomValidation<T>;
94
- declare function maxDuration<T extends Duration>(max: Duration, error?: ErrorMessage): valibot.CustomValidation<T>;
92
+ declare function minDuration(min: Duration, message?: ErrorMessage<CheckIssue<Duration>>): valibot.CheckAction<Duration, ErrorMessage<CheckIssue<Duration>>>;
93
+ declare function maxDuration(max: Duration, message?: ErrorMessage<CheckIssue<Duration>>): valibot.CheckAction<Duration, ErrorMessage<CheckIssue<Duration>>>;
95
94
 
96
- export { type BigFloatSchema, type BigIntSchema, type DateSchema, type DurationSchema, type DynamoDBStreamSchema, type JsonSchema, type SnsTopicSchema, type SqsQueueSchema, type UuidSchema, bigfloat, bigint, date, duration, dynamoDbStream, json, maxDuration, minDuration, positive, precision, snsTopic, sqsQueue, unique, uuid };
95
+ export { type BigFloatSchema, type DurationSchema, type DynamoDBStreamSchema, type JsonSchema, type SnsTopicSchema, type SqsQueueSchema, type UuidSchema, bigfloat, duration, dynamoDbStream, json, maxDuration, minDuration, positive, precision, snsTopic, sqsQueue, unique, uuid };
package/dist/index.d.ts CHANGED
@@ -1,74 +1,69 @@
1
1
  import * as valibot from 'valibot';
2
- import { BaseSchema, SchemaWithTransform, StringSchema, Output, Pipe, ErrorMessage, UnknownSchema, Input } from 'valibot';
2
+ import { BaseSchema, BaseIssue, ErrorMessage, InferOutput, InstanceIssue, InferInput, CheckIssue } from 'valibot';
3
3
  export * from 'valibot';
4
4
  import { BigFloat } from '@awsless/big-float';
5
5
  import { UUID } from 'crypto';
6
- import { Duration, DurationFormat } from '@awsless/duration';
6
+ import { Duration } from '@awsless/duration';
7
7
  import { AnyTable, PrimaryKey, Infer } from '@awsless/dynamodb';
8
8
 
9
- type JsonSchema<T extends BaseSchema> = SchemaWithTransform<StringSchema, Output<T>>;
10
- declare const json: <T extends BaseSchema>(schema: T) => JsonSchema<T>;
9
+ type Schema$2 = BaseSchema<unknown, unknown, BaseIssue<unknown>>;
10
+ type JsonIssue = BaseIssue<unknown>;
11
+ type JsonSchema<T extends Schema$2> = BaseSchema<string, InferOutput<T>, JsonIssue>;
12
+ declare const json: <T extends Schema$2>(schema: T, message?: ErrorMessage<JsonIssue>) => JsonSchema<T>;
11
13
 
12
- type BigFloatSchema = BaseSchema<string | number | BigFloat | {
13
- exponent: number;
14
- coefficient: bigint;
15
- }, BigFloat>;
16
- declare function bigfloat(pipe?: Pipe<BigFloat>): BigFloatSchema;
17
- declare function bigfloat(error?: ErrorMessage, pipe?: Pipe<BigFloat>): BigFloatSchema;
14
+ type BigFloatIssue = BaseIssue<unknown>;
15
+ type BigFloatSchema = BaseSchema<BigFloat | string | bigint | number, BigFloat, BigFloatIssue>;
16
+ declare function bigfloat(message?: ErrorMessage<BigFloatIssue>): BigFloatSchema;
18
17
 
19
- type BigIntSchema = BaseSchema<string | bigint, bigint>;
20
- declare function bigint(pipe?: Pipe<bigint>): BigIntSchema;
21
- declare function bigint(error?: ErrorMessage, pipe?: Pipe<bigint>): BigIntSchema;
18
+ type UuidIssue = BaseIssue<unknown>;
19
+ type UuidSchema = BaseSchema<UUID, UUID, UuidIssue>;
20
+ declare const uuid: (message?: ErrorMessage<UuidIssue>) => UuidSchema;
22
21
 
23
- type DateSchema = BaseSchema<string | Date, Date>;
24
- declare function date(pipe?: Pipe<Date>): DateSchema;
25
- declare function date(error?: ErrorMessage, pipe?: Pipe<Date>): DateSchema;
22
+ type DurationIssue = InstanceIssue;
23
+ type DurationSchema = BaseSchema<Duration, Duration, DurationIssue>;
24
+ declare function duration(message?: ErrorMessage<DurationIssue>): DurationSchema;
26
25
 
27
- type UuidSchema = BaseSchema<UUID, UUID>;
28
- declare const uuid: (error?: ErrorMessage) => UuidSchema;
29
-
30
- type DurationSchema = BaseSchema<DurationFormat | Duration, Duration>;
31
- declare function duration(pipe?: Pipe<Duration>): DurationSchema;
32
- declare function duration(error?: ErrorMessage, pipe?: Pipe<Duration>): DurationSchema;
33
-
34
- type SqsQueueSchema<S extends BaseSchema = UnknownSchema> = BaseSchema<Input<S> | Input<S>[] | {
26
+ type Schema$1 = BaseSchema<unknown, unknown, BaseIssue<unknown>>;
27
+ type SqsQueueIssue = BaseIssue<unknown>;
28
+ type SqsQueueSchema<S extends Schema$1> = BaseSchema<InferInput<S> | InferInput<S>[] | {
35
29
  Records: {
36
- body: string | Input<S>;
30
+ body: string | InferInput<S>;
37
31
  }[];
38
- }, Output<S>[]>;
39
- declare const sqsQueue: <S extends BaseSchema = UnknownSchema>(body?: S) => SqsQueueSchema<S>;
32
+ }, InferOutput<S>[], SqsQueueIssue>;
33
+ declare const sqsQueue: <S extends Schema$1>(schema: S, message?: ErrorMessage<SqsQueueIssue>) => SqsQueueSchema<S>;
40
34
 
41
- type SnsTopicSchema<S extends BaseSchema = UnknownSchema> = BaseSchema<Input<S> | Input<S>[] | {
35
+ type Schema = BaseSchema<unknown, unknown, BaseIssue<unknown>>;
36
+ type SnsTopicIssue = BaseIssue<unknown>;
37
+ type SnsTopicSchema<S extends Schema> = BaseSchema<InferInput<S> | InferInput<S>[] | {
42
38
  Records: {
43
39
  Sns: {
44
- Message: string | Input<S>;
40
+ Message: string | InferInput<S>;
45
41
  };
46
42
  }[];
47
- }, Output<S>[]>;
48
- declare const snsTopic: <S extends BaseSchema = UnknownSchema>(body?: S) => SnsTopicSchema<S>;
43
+ }, InferOutput<S>[], SnsTopicIssue>;
44
+ declare const snsTopic: <S extends Schema>(schema: S, message?: ErrorMessage<SnsTopicIssue>) => SnsTopicSchema<S>;
49
45
 
50
- type DynamoDBStreamSchema<T extends AnyTable> = BaseSchema<{
51
- Records: Array<{
52
- eventName: 'MODIFY';
53
- dynamodb: {
54
- Keys: unknown;
55
- OldImage: unknown;
56
- NewImage: unknown;
57
- };
58
- } | {
59
- eventName: 'INSERT';
60
- dynamodb: {
61
- Keys: unknown;
62
- NewImage: unknown;
63
- };
64
- } | {
65
- eventName: 'REMOVE';
66
- dynamodb: {
67
- Keys: unknown;
68
- OldImage: unknown;
69
- };
70
- }>;
71
- }, Array<{
46
+ type DynamoDBStreamInputRecord = {
47
+ eventName: 'MODIFY';
48
+ dynamodb: {
49
+ Keys: unknown;
50
+ OldImage: unknown;
51
+ NewImage: unknown;
52
+ };
53
+ } | {
54
+ eventName: 'INSERT';
55
+ dynamodb: {
56
+ Keys: unknown;
57
+ NewImage: unknown;
58
+ };
59
+ } | {
60
+ eventName: 'REMOVE';
61
+ dynamodb: {
62
+ Keys: unknown;
63
+ OldImage: unknown;
64
+ };
65
+ };
66
+ type DynamoDBStreamOutputRecord<T extends AnyTable> = {
72
67
  event: 'modify';
73
68
  keys: PrimaryKey<T>;
74
69
  old: Infer<T>;
@@ -81,16 +76,20 @@ type DynamoDBStreamSchema<T extends AnyTable> = BaseSchema<{
81
76
  event: 'remove';
82
77
  keys: PrimaryKey<T>;
83
78
  old: Infer<T>;
84
- }>>;
85
- declare const dynamoDbStream: <T extends AnyTable>(table: T) => DynamoDBStreamSchema<T>;
79
+ };
80
+ type DynamoDBStreamIssue = BaseIssue<unknown>;
81
+ type DynamoDBStreamSchema<T extends AnyTable> = BaseSchema<{
82
+ Records: DynamoDBStreamInputRecord[];
83
+ }, DynamoDBStreamOutputRecord<T>[], DynamoDBStreamIssue>;
84
+ declare const dynamoDbStream: <T extends AnyTable>(table: T, message?: ErrorMessage<DynamoDBStreamIssue>) => DynamoDBStreamSchema<T>;
86
85
 
87
- declare function positive<T extends BigFloat | number>(error?: ErrorMessage): valibot.CustomValidation<T>;
86
+ declare function positive<T extends BigFloat | number>(message?: ErrorMessage<CheckIssue<T>>): valibot.CheckAction<T, ErrorMessage<CheckIssue<T>>>;
88
87
 
89
- declare function precision<T extends BigFloat | number>(decimals: number, error?: ErrorMessage): valibot.CustomValidation<T>;
88
+ declare function precision<T extends BigFloat | number>(decimals: number, message?: ErrorMessage<CheckIssue<T>>): valibot.CheckAction<T, ErrorMessage<CheckIssue<T>>>;
90
89
 
91
- declare function unique<T extends any[]>(compare?: (a: T[number], b: T[number]) => boolean, error?: ErrorMessage): valibot.CustomValidation<T>;
90
+ declare function unique<T extends any[]>(compare?: (a: T[number], b: T[number]) => boolean, message?: ErrorMessage<CheckIssue<T>>): valibot.CheckAction<T, ErrorMessage<CheckIssue<T>>>;
92
91
 
93
- declare function minDuration<T extends Duration>(min: Duration, error?: ErrorMessage): valibot.CustomValidation<T>;
94
- declare function maxDuration<T extends Duration>(max: Duration, error?: ErrorMessage): valibot.CustomValidation<T>;
92
+ declare function minDuration(min: Duration, message?: ErrorMessage<CheckIssue<Duration>>): valibot.CheckAction<Duration, ErrorMessage<CheckIssue<Duration>>>;
93
+ declare function maxDuration(max: Duration, message?: ErrorMessage<CheckIssue<Duration>>): valibot.CheckAction<Duration, ErrorMessage<CheckIssue<Duration>>>;
95
94
 
96
- export { type BigFloatSchema, type BigIntSchema, type DateSchema, type DurationSchema, type DynamoDBStreamSchema, type JsonSchema, type SnsTopicSchema, type SqsQueueSchema, type UuidSchema, bigfloat, bigint, date, duration, dynamoDbStream, json, maxDuration, minDuration, positive, precision, snsTopic, sqsQueue, unique, uuid };
95
+ export { type BigFloatSchema, type DurationSchema, type DynamoDBStreamSchema, type JsonSchema, type SnsTopicSchema, type SqsQueueSchema, type UuidSchema, bigfloat, duration, dynamoDbStream, json, maxDuration, minDuration, positive, precision, snsTopic, sqsQueue, unique, uuid };
package/dist/index.js CHANGED
@@ -3,188 +3,169 @@ export * from "valibot";
3
3
 
4
4
  // src/schema/json.ts
5
5
  import { parse } from "@awsless/json";
6
- import { string, transform } from "valibot";
7
- var json = (schema) => {
8
- return transform(
9
- string(),
10
- (value) => {
6
+ import { pipe, rawTransform, string } from "valibot";
7
+ var json = (schema, message = "Invalid JSON") => {
8
+ return pipe(
9
+ string(message),
10
+ rawTransform((ctx) => {
11
+ let result;
11
12
  try {
12
- return parse(value);
13
- } catch (error) {
14
- return null;
13
+ result = parse(ctx.dataset.value);
14
+ } catch (_error) {
15
+ ctx.addIssue({
16
+ message
17
+ });
18
+ return ctx.NEVER;
15
19
  }
16
- },
20
+ return result;
21
+ }),
17
22
  schema
18
23
  );
19
24
  };
20
25
 
21
26
  // src/schema/bigfloat.ts
22
- import { BigFloat } from "@awsless/big-float";
27
+ import { BigFloat, parse as parse2 } from "@awsless/big-float";
23
28
  import {
24
29
  bigint,
25
- custom,
26
- defaultArgs,
30
+ decimal,
27
31
  instance,
28
32
  number,
29
- object,
33
+ pipe as pipe2,
30
34
  string as string2,
31
- transform as transform2,
35
+ transform,
32
36
  union
33
37
  } from "valibot";
34
- var make = (value) => new BigFloat(value);
35
- function bigfloat(arg1, arg2) {
36
- const [msg, pipe] = defaultArgs(arg1, arg2);
37
- const error = msg ?? "Invalid bigfloat";
38
+ function bigfloat(message = "Invalid bigfloat") {
38
39
  return union(
39
40
  [
40
- instance(BigFloat, pipe),
41
- transform2(string2([custom((input) => input !== "" && !isNaN(Number(input)), error)]), make, pipe),
42
- transform2(number(), make, pipe),
43
- transform2(
44
- object({
45
- exponent: number(),
46
- coefficient: bigint()
47
- }),
48
- make,
49
- pipe
50
- )
51
- ],
52
- error
53
- );
54
- }
55
-
56
- // src/schema/bigint.ts
57
- import { bigint as base, defaultArgs as defaultArgs2, regex, string as string3, transform as transform3, union as union2 } from "valibot";
58
- function bigint2(arg1, arg2) {
59
- const [error, pipe] = defaultArgs2(arg1, arg2);
60
- return union2(
61
- [
62
- base(pipe),
63
- transform3(
64
- string3([regex(/^-?[0-9]+$/)]),
65
- (input) => {
66
- return BigInt(input);
67
- },
68
- base(pipe)
69
- )
70
- ],
71
- error ?? "Invalid BigInt"
72
- );
73
- }
74
-
75
- // src/schema/date.ts
76
- import { date as base2, defaultArgs as defaultArgs3, string as string4, transform as transform4, union as union3 } from "valibot";
77
- function date(arg1, arg2) {
78
- const [error, pipe] = defaultArgs3(arg1, arg2);
79
- return union3(
80
- [
81
- base2(pipe),
82
- transform4(
83
- string4(),
84
- (input) => {
85
- return new Date(input);
86
- },
87
- base2(pipe)
41
+ instance(BigFloat),
42
+ pipe2(
43
+ string2(),
44
+ decimal(),
45
+ transform((v) => parse2(v))
46
+ ),
47
+ pipe2(
48
+ bigint(),
49
+ transform((v) => parse2(v))
50
+ ),
51
+ pipe2(
52
+ number(),
53
+ transform((v) => parse2(v))
88
54
  )
89
55
  ],
90
- error ?? "Invalid date"
56
+ message
91
57
  );
92
58
  }
93
59
 
94
60
  // src/schema/uuid.ts
95
- import { uuid as base3, string as string5 } from "valibot";
96
- var uuid = (error) => {
97
- return string5(error ?? "Invalid UUID", [base3()]);
61
+ import { uuid as base, pipe as pipe3, string as string3 } from "valibot";
62
+ var uuid = (message = "Invalid UUID") => {
63
+ return pipe3(string3(message), base(message));
98
64
  };
99
65
 
100
66
  // src/schema/duration.ts
101
67
  import { Duration } from "@awsless/duration";
102
- import { defaultArgs as defaultArgs4, instance as instance2 } from "valibot";
103
- function duration(arg1, arg2) {
104
- const [msg, pipe] = defaultArgs4(arg1, arg2);
105
- const error = msg ?? "Invalid duration";
106
- return instance2(Duration, error, pipe);
68
+ import { instance as instance2 } from "valibot";
69
+ function duration(message = "Invalid duration") {
70
+ return instance2(Duration, message);
107
71
  }
108
72
 
109
73
  // src/schema/aws/sqs-queue.ts
110
- import { array, object as object2, transform as transform5, union as union4, unknown } from "valibot";
111
- var sqsQueue = (body) => {
112
- const schema = body ?? unknown();
113
- return union4(
74
+ import {
75
+ array,
76
+ object,
77
+ pipe as pipe4,
78
+ transform as transform2,
79
+ union as union2
80
+ } from "valibot";
81
+ var sqsQueue = (schema, message = "Invalid SQS Queue payload") => {
82
+ return union2(
114
83
  [
115
- transform5(schema, (input) => [input]),
116
- array(schema),
117
- transform5(
118
- object2({
84
+ // Prioritize the expected payload during production
85
+ pipe4(
86
+ object({
119
87
  Records: array(
120
- object2({
88
+ object({
121
89
  body: json(schema)
122
90
  })
123
91
  )
124
92
  }),
125
- (input) => input.Records.map((record) => {
126
- return record.body;
127
- })
128
- )
93
+ transform2((v) => v.Records.map((r) => r.body))
94
+ ),
95
+ // These are allowed during testing
96
+ pipe4(
97
+ schema,
98
+ transform2((v) => [v])
99
+ ),
100
+ array(schema)
129
101
  ],
130
- "Invalid SQS Queue input"
102
+ message
131
103
  );
132
104
  };
133
105
 
134
106
  // src/schema/aws/sns-topic.ts
135
- import { array as array2, object as object3, transform as transform6, union as union5, unknown as unknown2 } from "valibot";
136
- var snsTopic = (body) => {
137
- const schema = body ?? unknown2();
138
- return union5(
107
+ import {
108
+ array as array2,
109
+ object as object2,
110
+ pipe as pipe5,
111
+ transform as transform3,
112
+ union as union3
113
+ } from "valibot";
114
+ var snsTopic = (schema, message = "Invalid SNS Topic payload") => {
115
+ return union3(
139
116
  [
140
- transform6(schema, (input) => [input]),
117
+ pipe5(
118
+ schema,
119
+ transform3((v) => [v])
120
+ ),
141
121
  array2(schema),
142
- transform6(
143
- object3({
122
+ pipe5(
123
+ object2({
144
124
  Records: array2(
145
- object3({
146
- Sns: object3({
125
+ object2({
126
+ Sns: object2({
147
127
  Message: json(schema)
148
128
  })
149
129
  })
150
130
  )
151
131
  }),
152
- (input) => input.Records.map((record) => {
153
- return record.Sns.Message;
154
- })
132
+ transform3((v) => v.Records.map((r) => r.Sns.Message))
155
133
  )
156
134
  ],
157
- "Invalid SNS Topic input"
135
+ message
158
136
  );
159
137
  };
160
138
 
161
139
  // src/schema/aws/dynamodb-stream.ts
162
- import { array as array3, literal, object as object4, transform as transform7, unknown as unknown3, variant } from "valibot";
163
- var dynamoDbStream = (table) => {
164
- const unmarshall = () => transform7(unknown3(), (value) => table.unmarshall(value));
165
- return transform7(
166
- object4(
140
+ import { array as array3, literal, object as object3, pipe as pipe6, transform as transform4, unknown, variant } from "valibot";
141
+ var dynamoDbStream = (table, message = "Invalid DynamoDB Stream payload") => {
142
+ const unmarshall = () => pipe6(
143
+ unknown(),
144
+ transform4((v) => table.unmarshall(v))
145
+ );
146
+ return pipe6(
147
+ object3(
167
148
  {
168
149
  Records: array3(
169
150
  variant("eventName", [
170
- object4({
151
+ object3({
171
152
  eventName: literal("MODIFY"),
172
- dynamodb: object4({
153
+ dynamodb: object3({
173
154
  Keys: unmarshall(),
174
155
  OldImage: unmarshall(),
175
156
  NewImage: unmarshall()
176
157
  })
177
158
  }),
178
- object4({
159
+ object3({
179
160
  eventName: literal("INSERT"),
180
- dynamodb: object4({
161
+ dynamodb: object3({
181
162
  Keys: unmarshall(),
182
163
  NewImage: unmarshall()
183
164
  })
184
165
  }),
185
- object4({
166
+ object3({
186
167
  eventName: literal("REMOVE"),
187
- dynamodb: object4({
168
+ dynamodb: object3({
188
169
  Keys: unmarshall(),
189
170
  OldImage: unmarshall()
190
171
  })
@@ -192,9 +173,9 @@ var dynamoDbStream = (table) => {
192
173
  ])
193
174
  )
194
175
  },
195
- "Invalid DynamoDB Stream input"
176
+ message
196
177
  ),
197
- (input) => {
178
+ transform4((input) => {
198
179
  return input.Records.map((record) => {
199
180
  const item = {
200
181
  event: record.eventName.toLowerCase(),
@@ -208,34 +189,31 @@ var dynamoDbStream = (table) => {
208
189
  }
209
190
  return item;
210
191
  });
211
- }
192
+ })
212
193
  );
213
194
  };
214
195
 
215
196
  // src/validation/positive.ts
216
- import { ZERO, gt } from "@awsless/big-float";
217
- import { custom as custom2 } from "valibot";
218
- function positive(error) {
219
- return custom2((input) => gt(input, ZERO), error ?? "Invalid positive number");
197
+ import { isPositive } from "@awsless/big-float";
198
+ import { check } from "valibot";
199
+ function positive(message = "Invalid positive number") {
200
+ return check((input) => isPositive(input), message);
220
201
  }
221
202
 
222
203
  // src/validation/precision.ts
223
- import { parse as parse2 } from "@awsless/big-float";
224
- import { custom as custom3 } from "valibot";
225
- function precision(decimals, error) {
226
- return custom3(
227
- (input) => {
228
- const big = parse2(input.toString());
229
- return -big.exponent <= decimals;
230
- },
231
- error ?? `Invalid ${decimals} precision number`
232
- );
204
+ import { parse as parse3 } from "@awsless/big-float";
205
+ import { check as check2 } from "valibot";
206
+ function precision(decimals, message = `Invalid ${decimals} precision number`) {
207
+ return check2((input) => {
208
+ const big = parse3(input.toString());
209
+ return -big.exponent <= decimals;
210
+ }, message);
233
211
  }
234
212
 
235
213
  // src/validation/unique.ts
236
- import { custom as custom4 } from "valibot";
237
- function unique(compare = (a, b) => a === b, error) {
238
- return custom4((input) => {
214
+ import { check as check3 } from "valibot";
215
+ function unique(compare = (a, b) => a === b, message = "None unique array") {
216
+ return check3((input) => {
239
217
  for (const x in input) {
240
218
  for (const y in input) {
241
219
  if (x !== y && compare(input[x], input[y])) {
@@ -244,21 +222,19 @@ function unique(compare = (a, b) => a === b, error) {
244
222
  }
245
223
  }
246
224
  return true;
247
- }, error ?? "None unique array");
225
+ }, message);
248
226
  }
249
227
 
250
228
  // src/validation/duration.ts
251
- import { custom as custom5 } from "valibot";
252
- function minDuration(min, error) {
253
- return custom5((input) => input.value >= min.value, error ?? "Invalid duration");
229
+ import { check as check4 } from "valibot";
230
+ function minDuration(min, message = "Invalid duration") {
231
+ return check4((input) => input.value >= min.value, message);
254
232
  }
255
- function maxDuration(max, error) {
256
- return custom5((input) => input.value <= max.value, error ?? "Invalid duration");
233
+ function maxDuration(max, message = "Invalid duration") {
234
+ return check4((input) => input.value <= max.value, message);
257
235
  }
258
236
  export {
259
237
  bigfloat,
260
- bigint2 as bigint,
261
- date,
262
238
  duration,
263
239
  dynamoDbStream,
264
240
  json,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/validate",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -25,18 +25,18 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@awsless/big-float": "^0.1.5",
28
- "@awsless/dynamodb": "^0.2.14",
29
28
  "@awsless/duration": "^0.0.4",
29
+ "@awsless/dynamodb": "^0.3.2",
30
30
  "@awsless/json": "^0.0.10"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@awsless/big-float": "^0.1.5",
34
- "@awsless/dynamodb": "^0.2.14",
35
- "@awsless/json": "^0.0.10",
36
- "@awsless/duration": "^0.0.4"
34
+ "@awsless/duration": "^0.0.4",
35
+ "@awsless/dynamodb": "^0.3.2",
36
+ "@awsless/json": "^0.0.10"
37
37
  },
38
38
  "dependencies": {
39
- "valibot": "^0.30.0"
39
+ "valibot": "^1.2.0"
40
40
  },
41
41
  "scripts": {
42
42
  "test": "pnpm code test",