@awsless/validate 0.0.21 → 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,193 +62,173 @@ 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 marshall = () => (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.object)({
198
- // For some reason picklist fails to build.
199
- // eventName: picklist(['MODIFY', 'INSERT', 'REMOVE']),
200
- eventName: (0, import_valibot9.union)([(0, import_valibot9.literal)("MODIFY"), (0, import_valibot9.literal)("INSERT"), (0, import_valibot9.literal)("REMOVE")]),
201
- dynamodb: (0, import_valibot9.object)({
202
- Keys: marshall(),
203
- OldImage: (0, import_valibot9.optional)(marshall()),
204
- NewImage: (0, import_valibot9.optional)(marshall())
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)({
169
+ Keys: unmarshall(),
170
+ OldImage: unmarshall(),
171
+ NewImage: unmarshall()
172
+ })
173
+ }),
174
+ (0, import_valibot7.object)({
175
+ eventName: (0, import_valibot7.literal)("INSERT"),
176
+ dynamodb: (0, import_valibot7.object)({
177
+ Keys: unmarshall(),
178
+ NewImage: unmarshall()
179
+ })
180
+ }),
181
+ (0, import_valibot7.object)({
182
+ eventName: (0, import_valibot7.literal)("REMOVE"),
183
+ dynamodb: (0, import_valibot7.object)({
184
+ Keys: unmarshall(),
185
+ OldImage: unmarshall()
186
+ })
205
187
  })
206
- })
188
+ ])
207
189
  )
208
190
  },
209
- "Invalid DynamoDB Stream input"
191
+ message
210
192
  ),
211
- (input) => {
193
+ (0, import_valibot7.transform)((input) => {
212
194
  return input.Records.map((record) => {
213
- const item = record;
214
- return {
195
+ const item = {
215
196
  event: record.eventName.toLowerCase(),
216
- keys: item.dynamodb.Keys,
217
- old: item.dynamodb.OldImage,
218
- new: item.dynamodb.NewImage
197
+ keys: record.dynamodb.Keys
219
198
  };
199
+ if ("OldImage" in record.dynamodb) {
200
+ item.old = record.dynamodb.OldImage;
201
+ }
202
+ if ("NewImage" in record.dynamodb) {
203
+ item.new = record.dynamodb.NewImage;
204
+ }
205
+ return item;
220
206
  });
221
- }
207
+ })
222
208
  );
223
209
  };
224
210
 
225
211
  // src/validation/positive.ts
226
212
  var import_big_float2 = require("@awsless/big-float");
227
- var import_valibot10 = require("valibot");
228
- function positive(error) {
229
- 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);
230
216
  }
231
217
 
232
218
  // src/validation/precision.ts
233
219
  var import_big_float3 = require("@awsless/big-float");
234
- var import_valibot11 = require("valibot");
235
- function precision(decimals, error) {
236
- return (0, import_valibot11.custom)(
237
- (input) => {
238
- const big = (0, import_big_float3.parse)(input.toString());
239
- return -big.exponent <= decimals;
240
- },
241
- error ?? `Invalid ${decimals} precision number`
242
- );
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);
243
226
  }
244
227
 
245
228
  // src/validation/unique.ts
246
- var import_valibot12 = require("valibot");
247
- function unique(compare = (a, b) => a === b, error) {
248
- 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) => {
249
232
  for (const x in input) {
250
233
  for (const y in input) {
251
234
  if (x !== y && compare(input[x], input[y])) {
@@ -254,22 +237,20 @@ function unique(compare = (a, b) => a === b, error) {
254
237
  }
255
238
  }
256
239
  return true;
257
- }, error ?? "None unique array");
240
+ }, message);
258
241
  }
259
242
 
260
243
  // src/validation/duration.ts
261
- var import_valibot13 = require("valibot");
262
- function minDuration(min, error) {
263
- 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);
264
247
  }
265
- function maxDuration(max, error) {
266
- 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);
267
250
  }
268
251
  // Annotate the CommonJS export names for ESM import in node:
269
252
  0 && (module.exports = {
270
253
  bigfloat,
271
- bigint,
272
- date,
273
254
  duration,
274
255
  dynamoDbStream,
275
256
  json,
package/dist/index.d.cts CHANGED
@@ -1,77 +1,95 @@
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 EventName = 'MODIFY' | 'INSERT' | 'REMOVE';
51
- type DynamoDBStreamSchema<T extends AnyTable> = BaseSchema<{
52
- Records: {
53
- eventName: EventName;
54
- dynamodb: {
55
- Keys: unknown;
56
- OldImage?: unknown;
57
- NewImage?: unknown;
58
- };
59
- }[];
60
- }, {
61
- event: Lowercase<EventName>;
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> = {
67
+ event: 'modify';
68
+ keys: PrimaryKey<T>;
69
+ old: Infer<T>;
70
+ new: Infer<T>;
71
+ } | {
72
+ event: 'insert';
62
73
  keys: PrimaryKey<T>;
63
- old?: Infer<T>;
64
- new?: Infer<T>;
65
- }[]>;
66
- declare const dynamoDbStream: <T extends AnyTable>(table: T) => DynamoDBStreamSchema<T>;
74
+ new: Infer<T>;
75
+ } | {
76
+ event: 'remove';
77
+ keys: PrimaryKey<T>;
78
+ old: Infer<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>;
67
85
 
68
- 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>>>;
69
87
 
70
- 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>>>;
71
89
 
72
- 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>>>;
73
91
 
74
- declare function minDuration<T extends Duration>(min: Duration, error?: ErrorMessage): valibot.CustomValidation<T>;
75
- 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>>>;
76
94
 
77
- 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,77 +1,95 @@
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 EventName = 'MODIFY' | 'INSERT' | 'REMOVE';
51
- type DynamoDBStreamSchema<T extends AnyTable> = BaseSchema<{
52
- Records: {
53
- eventName: EventName;
54
- dynamodb: {
55
- Keys: unknown;
56
- OldImage?: unknown;
57
- NewImage?: unknown;
58
- };
59
- }[];
60
- }, {
61
- event: Lowercase<EventName>;
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> = {
67
+ event: 'modify';
68
+ keys: PrimaryKey<T>;
69
+ old: Infer<T>;
70
+ new: Infer<T>;
71
+ } | {
72
+ event: 'insert';
62
73
  keys: PrimaryKey<T>;
63
- old?: Infer<T>;
64
- new?: Infer<T>;
65
- }[]>;
66
- declare const dynamoDbStream: <T extends AnyTable>(table: T) => DynamoDBStreamSchema<T>;
74
+ new: Infer<T>;
75
+ } | {
76
+ event: 'remove';
77
+ keys: PrimaryKey<T>;
78
+ old: Infer<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>;
67
85
 
68
- 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>>>;
69
87
 
70
- 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>>>;
71
89
 
72
- 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>>>;
73
91
 
74
- declare function minDuration<T extends Duration>(min: Duration, error?: ErrorMessage): valibot.CustomValidation<T>;
75
- 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>>>;
76
94
 
77
- 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,221 +3,217 @@ 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)
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))
69
54
  )
70
55
  ],
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)
88
- )
89
- ],
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, optional, transform as transform7, union as union6, unknown as unknown3 } from "valibot";
163
- var dynamoDbStream = (table) => {
164
- const marshall = () => 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
- object4({
170
- // For some reason picklist fails to build.
171
- // eventName: picklist(['MODIFY', 'INSERT', 'REMOVE']),
172
- eventName: union6([literal("MODIFY"), literal("INSERT"), literal("REMOVE")]),
173
- dynamodb: object4({
174
- Keys: marshall(),
175
- OldImage: optional(marshall()),
176
- NewImage: optional(marshall())
150
+ variant("eventName", [
151
+ object3({
152
+ eventName: literal("MODIFY"),
153
+ dynamodb: object3({
154
+ Keys: unmarshall(),
155
+ OldImage: unmarshall(),
156
+ NewImage: unmarshall()
157
+ })
158
+ }),
159
+ object3({
160
+ eventName: literal("INSERT"),
161
+ dynamodb: object3({
162
+ Keys: unmarshall(),
163
+ NewImage: unmarshall()
164
+ })
165
+ }),
166
+ object3({
167
+ eventName: literal("REMOVE"),
168
+ dynamodb: object3({
169
+ Keys: unmarshall(),
170
+ OldImage: unmarshall()
171
+ })
177
172
  })
178
- })
173
+ ])
179
174
  )
180
175
  },
181
- "Invalid DynamoDB Stream input"
176
+ message
182
177
  ),
183
- (input) => {
178
+ transform4((input) => {
184
179
  return input.Records.map((record) => {
185
- const item = record;
186
- return {
180
+ const item = {
187
181
  event: record.eventName.toLowerCase(),
188
- keys: item.dynamodb.Keys,
189
- old: item.dynamodb.OldImage,
190
- new: item.dynamodb.NewImage
182
+ keys: record.dynamodb.Keys
191
183
  };
184
+ if ("OldImage" in record.dynamodb) {
185
+ item.old = record.dynamodb.OldImage;
186
+ }
187
+ if ("NewImage" in record.dynamodb) {
188
+ item.new = record.dynamodb.NewImage;
189
+ }
190
+ return item;
192
191
  });
193
- }
192
+ })
194
193
  );
195
194
  };
196
195
 
197
196
  // src/validation/positive.ts
198
- import { ZERO, gt } from "@awsless/big-float";
199
- import { custom as custom2 } from "valibot";
200
- function positive(error) {
201
- 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);
202
201
  }
203
202
 
204
203
  // src/validation/precision.ts
205
- import { parse as parse2 } from "@awsless/big-float";
206
- import { custom as custom3 } from "valibot";
207
- function precision(decimals, error) {
208
- return custom3(
209
- (input) => {
210
- const big = parse2(input.toString());
211
- return -big.exponent <= decimals;
212
- },
213
- error ?? `Invalid ${decimals} precision number`
214
- );
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);
215
211
  }
216
212
 
217
213
  // src/validation/unique.ts
218
- import { custom as custom4 } from "valibot";
219
- function unique(compare = (a, b) => a === b, error) {
220
- 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) => {
221
217
  for (const x in input) {
222
218
  for (const y in input) {
223
219
  if (x !== y && compare(input[x], input[y])) {
@@ -226,21 +222,19 @@ function unique(compare = (a, b) => a === b, error) {
226
222
  }
227
223
  }
228
224
  return true;
229
- }, error ?? "None unique array");
225
+ }, message);
230
226
  }
231
227
 
232
228
  // src/validation/duration.ts
233
- import { custom as custom5 } from "valibot";
234
- function minDuration(min, error) {
235
- 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);
236
232
  }
237
- function maxDuration(max, error) {
238
- 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);
239
235
  }
240
236
  export {
241
237
  bigfloat,
242
- bigint2 as bigint,
243
- date,
244
238
  duration,
245
239
  dynamoDbStream,
246
240
  json,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/validate",
3
- "version": "0.0.21",
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.12",
29
- "@awsless/duration": "^0.0.3",
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/duration": "^0.0.3",
35
- "@awsless/dynamodb": "^0.2.12",
34
+ "@awsless/duration": "^0.0.4",
35
+ "@awsless/dynamodb": "^0.3.2",
36
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",