@awsless/validate 0.0.9 → 0.0.10

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
@@ -122,7 +122,7 @@ function duration(arg1, arg2) {
122
122
  const [msg, pipe] = (0, import_valibot5.getDefaultArgs)(arg1, arg2);
123
123
  const error = msg ?? "Invalid duration";
124
124
  return (0, import_valibot5.transform)(
125
- (0, import_valibot5.string)(error, [(0, import_valibot5.regex)(/^[0-9]+ (milliseconds?|seconds?|minutes?|hours?|days?)/)]),
125
+ (0, import_valibot5.string)(error, [(0, import_valibot5.regex)(/^[0-9]+ (milliseconds?|seconds?|minutes?|hours?|days?)/, error)]),
126
126
  (value) => (0, import_duration.parse)(value),
127
127
  pipe
128
128
  );
@@ -251,14 +251,10 @@ function unique(compare = (a, b) => a === b, error) {
251
251
  // src/validation/duration.ts
252
252
  var import_valibot12 = require("valibot");
253
253
  function minDuration(min, error) {
254
- return (input) => {
255
- return input.value >= min.value ? (0, import_valibot12.getOutput)(input) : (0, import_valibot12.getPipeIssues)("min-duration", error ?? "Invalid duration", input);
256
- };
254
+ return (0, import_valibot12.custom)((input) => input.value >= min.value, error ?? "Invalid duration");
257
255
  }
258
256
  function maxDuration(max, error) {
259
- return (input) => {
260
- return input.value <= max.value ? (0, import_valibot12.getOutput)(input) : (0, import_valibot12.getPipeIssues)("max-duration", error ?? "Invalid duration", input);
261
- };
257
+ return (0, import_valibot12.custom)((input) => input.value <= max.value, error ?? "Invalid duration");
262
258
  }
263
259
  // Annotate the CommonJS export names for ESM import in node:
264
260
  0 && (module.exports = {
package/dist/index.d.cts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as valibot from 'valibot';
1
2
  import { BaseSchema, SchemaWithTransform, StringSchema, Output, Pipe, ErrorMessage, UnknownSchema, Input, PipeResult } from 'valibot';
2
3
  export * from 'valibot';
3
4
  import { BigFloat } from '@awsless/big-float';
@@ -66,7 +67,7 @@ declare function precision<T extends BigFloat | number>(decimals: number, error?
66
67
 
67
68
  declare function unique<T extends any[]>(compare?: (a: T[number], b: T[number]) => boolean, error?: ErrorMessage): (input: T) => PipeResult<T>;
68
69
 
69
- declare function minDuration<T extends Duration>(min: Duration, error?: ErrorMessage): (input: T) => PipeResult<T>;
70
- declare function maxDuration<T extends Duration>(max: Duration, error?: ErrorMessage): (input: T) => PipeResult<T>;
70
+ declare function minDuration<T extends Duration>(min: Duration, error?: ErrorMessage): (input: T) => valibot.PipeResult<T>;
71
+ declare function maxDuration<T extends Duration>(max: Duration, error?: ErrorMessage): (input: T) => valibot.PipeResult<T>;
71
72
 
72
73
  export { BigFloatSchema, DateSchema, DurationSchema, DynamoDBStreamSchema, JsonSchema, SnsTopicSchema, SqsQueueSchema, UuidSchema, bigfloat, date, duration, dynamoDbStream, json, maxDuration, minDuration, positive, precision, snsTopic, sqsQueue, unique, uuid };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as valibot from 'valibot';
1
2
  import { BaseSchema, SchemaWithTransform, StringSchema, Output, Pipe, ErrorMessage, UnknownSchema, Input, PipeResult } from 'valibot';
2
3
  export * from 'valibot';
3
4
  import { BigFloat } from '@awsless/big-float';
@@ -66,7 +67,7 @@ declare function precision<T extends BigFloat | number>(decimals: number, error?
66
67
 
67
68
  declare function unique<T extends any[]>(compare?: (a: T[number], b: T[number]) => boolean, error?: ErrorMessage): (input: T) => PipeResult<T>;
68
69
 
69
- declare function minDuration<T extends Duration>(min: Duration, error?: ErrorMessage): (input: T) => PipeResult<T>;
70
- declare function maxDuration<T extends Duration>(max: Duration, error?: ErrorMessage): (input: T) => PipeResult<T>;
70
+ declare function minDuration<T extends Duration>(min: Duration, error?: ErrorMessage): (input: T) => valibot.PipeResult<T>;
71
+ declare function maxDuration<T extends Duration>(max: Duration, error?: ErrorMessage): (input: T) => valibot.PipeResult<T>;
71
72
 
72
73
  export { BigFloatSchema, DateSchema, DurationSchema, DynamoDBStreamSchema, JsonSchema, SnsTopicSchema, SqsQueueSchema, UuidSchema, bigfloat, date, duration, dynamoDbStream, json, maxDuration, minDuration, positive, precision, snsTopic, sqsQueue, unique, uuid };
package/dist/index.js CHANGED
@@ -100,7 +100,7 @@ function duration(arg1, arg2) {
100
100
  const [msg, pipe] = getDefaultArgs3(arg1, arg2);
101
101
  const error = msg ?? "Invalid duration";
102
102
  return transform5(
103
- string5(error, [regex(/^[0-9]+ (milliseconds?|seconds?|minutes?|hours?|days?)/)]),
103
+ string5(error, [regex(/^[0-9]+ (milliseconds?|seconds?|minutes?|hours?|days?)/, error)]),
104
104
  (value) => parse(value),
105
105
  pipe
106
106
  );
@@ -227,16 +227,12 @@ function unique(compare = (a, b) => a === b, error) {
227
227
  }
228
228
 
229
229
  // src/validation/duration.ts
230
- import { getOutput as getOutput5, getPipeIssues as getPipeIssues5 } from "valibot";
230
+ import { custom } from "valibot";
231
231
  function minDuration(min, error) {
232
- return (input) => {
233
- return input.value >= min.value ? getOutput5(input) : getPipeIssues5("min-duration", error ?? "Invalid duration", input);
234
- };
232
+ return custom((input) => input.value >= min.value, error ?? "Invalid duration");
235
233
  }
236
234
  function maxDuration(max, error) {
237
- return (input) => {
238
- return input.value <= max.value ? getOutput5(input) : getPipeIssues5("max-duration", error ?? "Invalid duration", input);
239
- };
235
+ return custom((input) => input.value <= max.value, error ?? "Invalid duration");
240
236
  }
241
237
  export {
242
238
  bigfloat,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/validate",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {