@bgord/tools 1.3.24 → 1.4.1

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.
Files changed (125) hide show
  1. package/dist/age-years.vo.d.ts +3 -3
  2. package/dist/age-years.vo.js +4 -9
  3. package/dist/age.vo.js +2 -1
  4. package/dist/api-key.vo.d.ts +3 -4
  5. package/dist/api-key.vo.js +5 -9
  6. package/dist/basename.vo.d.ts +3 -3
  7. package/dist/basename.vo.js +10 -15
  8. package/dist/day-iso-id.vo.d.ts +3 -3
  9. package/dist/day-iso-id.vo.js +4 -8
  10. package/dist/day.vo.d.ts +1 -1
  11. package/dist/day.vo.js +7 -6
  12. package/dist/directory-path-absolute.vo.d.ts +3 -3
  13. package/dist/directory-path-absolute.vo.js +5 -12
  14. package/dist/directory-path-relative.vo.d.ts +3 -3
  15. package/dist/directory-path-relative.vo.js +5 -12
  16. package/dist/distance-value.vo.d.ts +3 -3
  17. package/dist/distance-value.vo.js +4 -8
  18. package/dist/distance.vo.js +7 -6
  19. package/dist/division-factor.vo.d.ts +3 -3
  20. package/dist/division-factor.vo.js +4 -7
  21. package/dist/duration-ms.vo.d.ts +3 -3
  22. package/dist/duration-ms.vo.js +4 -3
  23. package/dist/duration.service.js +2 -1
  24. package/dist/email.vo.d.ts +3 -3
  25. package/dist/email.vo.js +3 -3
  26. package/dist/etags.vo.js +3 -2
  27. package/dist/extension.vo.d.ts +3 -3
  28. package/dist/extension.vo.js +6 -12
  29. package/dist/feature-flag-value.vo.d.ts +3 -3
  30. package/dist/feature-flag-value.vo.js +2 -2
  31. package/dist/file-path-absolute-schema.vo.d.ts +8 -5
  32. package/dist/file-path-absolute-schema.vo.js +6 -13
  33. package/dist/file-path-relative-schema.vo.d.ts +8 -5
  34. package/dist/file-path-relative-schema.vo.js +6 -13
  35. package/dist/file-path.vo.js +5 -4
  36. package/dist/filename-affix.vo.d.ts +3 -3
  37. package/dist/filename-affix.vo.js +4 -9
  38. package/dist/filename-from-string.vo.d.ts +6 -6
  39. package/dist/filename-from-string.vo.js +5 -8
  40. package/dist/filename.vo.js +8 -7
  41. package/dist/height-milimiters.vo.d.ts +3 -3
  42. package/dist/height-milimiters.vo.js +4 -8
  43. package/dist/height.vo.js +4 -3
  44. package/dist/hour-value.vo.d.ts +3 -3
  45. package/dist/hour-value.vo.js +4 -9
  46. package/dist/hour.vo.js +3 -2
  47. package/dist/iban-schema.vo.d.ts +3 -3
  48. package/dist/iban-schema.vo.js +4 -9
  49. package/dist/iban.vo.js +2 -1
  50. package/dist/image.vo.d.ts +5 -5
  51. package/dist/image.vo.js +7 -17
  52. package/dist/integer-non-negative.vo.d.ts +3 -3
  53. package/dist/integer-non-negative.vo.js +4 -8
  54. package/dist/integer-positive.vo.d.ts +3 -3
  55. package/dist/integer-positive.vo.js +4 -8
  56. package/dist/integer.vo.d.ts +3 -3
  57. package/dist/integer.vo.js +3 -3
  58. package/dist/language.vo.d.ts +3 -3
  59. package/dist/language.vo.js +2 -2
  60. package/dist/mime-value.vo.d.ts +3 -2
  61. package/dist/mime-value.vo.js +4 -7
  62. package/dist/mime.vo.js +2 -1
  63. package/dist/mimes.js +12 -11
  64. package/dist/minute-value.vo.d.ts +3 -3
  65. package/dist/minute-value.vo.js +4 -9
  66. package/dist/minute.vo.js +3 -2
  67. package/dist/money-amount.vo.d.ts +3 -3
  68. package/dist/money-amount.vo.js +4 -8
  69. package/dist/money.vo.js +7 -6
  70. package/dist/month-iso-id.vo.d.ts +3 -3
  71. package/dist/month-iso-id.vo.js +5 -9
  72. package/dist/month.vo.js +5 -4
  73. package/dist/multiplication-factor.vo.d.ts +3 -3
  74. package/dist/multiplication-factor.vo.js +4 -7
  75. package/dist/object-key.vo.d.ts +3 -3
  76. package/dist/object-key.vo.js +8 -13
  77. package/dist/package-version-schema.vo.d.ts +3 -3
  78. package/dist/package-version-schema.vo.js +4 -7
  79. package/dist/package-version.vo.js +3 -4
  80. package/dist/pagination-page.vo.d.ts +3 -3
  81. package/dist/pagination-page.vo.js +2 -6
  82. package/dist/pagination-skip.vo.d.ts +3 -3
  83. package/dist/pagination-skip.vo.js +2 -5
  84. package/dist/pagination-take.vo.d.ts +3 -3
  85. package/dist/pagination-take.vo.js +2 -5
  86. package/dist/pagination.service.js +8 -7
  87. package/dist/quarter-iso-id.vo.d.ts +4 -3
  88. package/dist/quarter-iso-id.vo.js +7 -11
  89. package/dist/quarter.vo.js +3 -2
  90. package/dist/reordering-item-position-value.vo.d.ts +3 -3
  91. package/dist/reordering-item-position-value.vo.js +2 -5
  92. package/dist/reordering.service.d.ts +9 -9
  93. package/dist/reordering.service.js +7 -7
  94. package/dist/revision-value.vo.d.ts +3 -3
  95. package/dist/revision-value.vo.js +2 -5
  96. package/dist/revision.vo.js +3 -2
  97. package/dist/rounding-decimal.strategy.d.ts +2 -2
  98. package/dist/rounding-decimal.strategy.js +5 -10
  99. package/dist/size-bytes.vo.d.ts +3 -3
  100. package/dist/size-bytes.vo.js +4 -8
  101. package/dist/size.vo.js +5 -4
  102. package/dist/time-zone-offset-value.vo.d.ts +3 -3
  103. package/dist/time-zone-offset-value.vo.js +8 -12
  104. package/dist/timestamp-value.vo.d.ts +3 -3
  105. package/dist/timestamp-value.vo.js +4 -8
  106. package/dist/timestamp.vo.js +2 -1
  107. package/dist/timezone.vo.d.ts +3 -3
  108. package/dist/timezone.vo.js +7 -10
  109. package/dist/url-with-slash.vo.d.ts +3 -3
  110. package/dist/url-with-slash.vo.js +4 -7
  111. package/dist/url-without-slash.vo.d.ts +3 -3
  112. package/dist/url-without-slash.vo.js +4 -7
  113. package/dist/week-iso-id.vo.d.ts +3 -3
  114. package/dist/week-iso-id.vo.js +5 -9
  115. package/dist/week.vo.js +5 -4
  116. package/dist/weekday-iso-id.vo.d.ts +3 -3
  117. package/dist/weekday-iso-id.vo.js +4 -9
  118. package/dist/weekday.vo.js +9 -8
  119. package/dist/weight-grams.vo.d.ts +3 -3
  120. package/dist/weight-grams.vo.js +4 -8
  121. package/dist/weight.vo.js +8 -7
  122. package/dist/year-iso-id.vo.d.ts +3 -3
  123. package/dist/year-iso-id.vo.js +4 -7
  124. package/dist/year.vo.js +6 -5
  125. package/package.json +9 -12
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const AgeYearsError: {
3
3
  Type: string;
4
4
  Invalid: string;
@@ -7,5 +7,5 @@ export declare const AgeYearsConstraints: {
7
7
  min: number;
8
8
  max: number;
9
9
  };
10
- export declare const AgeYears: z.core.$ZodBranded<z.ZodNumber, "AgeYears", "out">;
11
- export type AgeYearsType = z.infer<typeof AgeYears>;
10
+ export declare const AgeYears: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.MaxValueAction<number, 130, string>, v.BrandAction<number, "AgeYears">]>;
11
+ export type AgeYearsType = v.InferOutput<typeof AgeYears>;
@@ -1,11 +1,6 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export const AgeYearsError = { Type: "age.years.type", Invalid: "age.years.invalid" };
3
3
  export const AgeYearsConstraints = { min: 0, max: 130 };
4
- // Stryker disable all
5
- export const AgeYears = z
6
- // Stryker restore all
7
- .number(AgeYearsError.Type)
8
- .int(AgeYearsError.Type)
9
- .min(0, AgeYearsError.Invalid)
10
- .max(130, AgeYearsError.Invalid)
11
- .brand("AgeYears");
4
+ export const AgeYears = v.pipe(v.number(AgeYearsError.Type), v.integer(AgeYearsError.Type), v.minValue(0, AgeYearsError.Invalid), v.maxValue(130, AgeYearsError.Invalid),
5
+ // Stryker disable next-line StringLiteral
6
+ v.brand("AgeYears"));
package/dist/age.vo.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { differenceInYears } from "date-fns";
2
+ import * as v from "valibot";
2
3
  import { AgeYears, AgeYearsConstraints } from "./age-years.vo";
3
4
  import { Timestamp } from "./timestamp.vo";
4
5
  export const AgeError = { FutureBirthdate: "age.future.birthdate" };
@@ -10,7 +11,7 @@ export class Age {
10
11
  this.value = value;
11
12
  }
12
13
  static fromValue(candidate) {
13
- return new Age(AgeYears.parse(candidate));
14
+ return new Age(v.parse(AgeYears, candidate));
14
15
  }
15
16
  static fromValueSafe(candidate) {
16
17
  return new Age(candidate);
@@ -1,8 +1,7 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const ApiKeyError: {
3
3
  Type: string;
4
- Length: string;
5
4
  BadChars: string;
6
5
  };
7
- export declare const ApiKey: z.core.$ZodBranded<z.ZodString, "ApiKey", "out">;
8
- export type ApiKeyType = z.infer<typeof ApiKey>;
6
+ export declare const ApiKey: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.BrandAction<string, "ApiKey">]>;
7
+ export type ApiKeyType = v.InferOutput<typeof ApiKey>;
@@ -1,11 +1,7 @@
1
- import * as z from "zod/v4";
2
- export const ApiKeyError = { Type: "api.key.type", Length: "api.key.length", BadChars: "api.key.bad.chars" };
1
+ import * as v from "valibot";
2
+ export const ApiKeyError = { Type: "api.key.type", BadChars: "api.key.bad.chars" };
3
3
  // 64 letters and digits allowed
4
4
  const API_KEY_CHARS = /^[a-zA-Z0-9]{64}$/;
5
- // Stryker disable all
6
- export const ApiKey = z
7
- // Stryker disable all
8
- .string(ApiKeyError.Type)
9
- .length(64, ApiKeyError.Length)
10
- .regex(API_KEY_CHARS, ApiKeyError.BadChars)
11
- .brand("ApiKey");
5
+ export const ApiKey = v.pipe(v.string(ApiKeyError.Type), v.regex(API_KEY_CHARS, ApiKeyError.BadChars),
6
+ // Stryker disable next-line StringLiteral
7
+ v.brand("ApiKey"));
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const BasenameError: {
3
3
  Type: string;
4
4
  Empty: string;
@@ -8,5 +8,5 @@ export declare const BasenameError: {
8
8
  TrailingDot: string;
9
9
  BadChars: string;
10
10
  };
11
- export declare const Basename: z.core.$ZodBranded<z.ZodString, "Basename", "out">;
12
- export type BasenameType = z.infer<typeof Basename>;
11
+ export declare const Basename: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 128, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.RegexAction<string, string>, v.BrandAction<string, "Basename">]>;
12
+ export type BasenameType = v.InferOutput<typeof Basename>;
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export const BasenameError = {
3
3
  Type: "basename.type",
4
4
  Empty: "basename.empty",
@@ -11,17 +11,12 @@ export const BasenameError = {
11
11
  // Letters, digits, dots, underscores, and hyphens allowed
12
12
  const BASENAME_CHARS = /^[a-zA-Z0-9._-]+$/;
13
13
  const DOT_SEGMENTS = [".", ".."];
14
- // Stryker disable all
15
- export const Basename = z
16
- // Stryker restore all
17
- .string(BasenameError.Type)
18
- .min(1, BasenameError.Empty)
19
- .max(128, BasenameError.TooLong)
20
- // Reject "." and ".." as a filename to avoid directory traversal
21
- .refine((value) => !DOT_SEGMENTS.includes(value), BasenameError.DotSegments)
22
- // Reject dotfiles like ".env"
23
- .refine((value) => !value.startsWith("."), BasenameError.Dotfiles)
24
- // Reject trailing dot like "picture." to avoid extension collision
25
- .refine((value) => !value.endsWith("."), BasenameError.TrailingDot)
26
- .regex(BASENAME_CHARS, BasenameError.BadChars)
27
- .brand("Basename");
14
+ export const Basename = v.pipe(v.string(BasenameError.Type), v.minLength(1, BasenameError.Empty), v.maxLength(128, BasenameError.TooLong),
15
+ // Reject "." and ".." as a filename to avoid directory traversal
16
+ v.check((value) => !DOT_SEGMENTS.includes(value), BasenameError.DotSegments),
17
+ // Reject dotfiles like ".env"
18
+ v.check((value) => !value.startsWith("."), BasenameError.Dotfiles),
19
+ // Reject trailing dot like "picture." to avoid extension collision
20
+ v.check((value) => !value.endsWith("."), BasenameError.TrailingDot), v.regex(BASENAME_CHARS, BasenameError.BadChars),
21
+ // Stryker disable next-line StringLiteral
22
+ v.brand("Basename"));
@@ -1,9 +1,9 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const DayIsoIdError: {
3
3
  Type: string;
4
4
  BadChars: string;
5
5
  InvalidDate: string;
6
6
  };
7
7
  export declare const DAY_ISO_ID_CHARS: RegExp;
8
- export declare const DayIsoId: z.core.$ZodBranded<z.ZodString, "DayIsoId", "out">;
9
- export type DayIsoIdType = z.infer<typeof DayIsoId>;
8
+ export declare const DayIsoId: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.CheckAction<string, string>, v.BrandAction<string, "DayIsoId">]>;
9
+ export type DayIsoIdType = v.InferOutput<typeof DayIsoId>;
@@ -1,5 +1,5 @@
1
1
  import { isValid, parseISO } from "date-fns";
2
- import * as z from "zod/v4";
2
+ import * as v from "valibot";
3
3
  export const DayIsoIdError = {
4
4
  Type: "day.iso.id.type",
5
5
  BadChars: "day.iso.id.bad.chars",
@@ -7,10 +7,6 @@ export const DayIsoIdError = {
7
7
  };
8
8
  // Four digits, hyphen, two digits, hyphen, two digits
9
9
  export const DAY_ISO_ID_CHARS = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
10
- // Stryker disable all
11
- export const DayIsoId = z
12
- // Stryker restore all
13
- .string(DayIsoIdError.Type)
14
- .regex(DAY_ISO_ID_CHARS, DayIsoIdError.BadChars)
15
- .refine((value) => isValid(parseISO(value)), DayIsoIdError.InvalidDate)
16
- .brand("DayIsoId");
10
+ export const DayIsoId = v.pipe(v.string(DayIsoIdError.Type), v.regex(DAY_ISO_ID_CHARS, DayIsoIdError.BadChars), v.check((value) => isValid(parseISO(value)), DayIsoIdError.InvalidDate),
11
+ // Stryker disable next-line StringLiteral
12
+ v.brand("DayIsoId"));
package/dist/day.vo.d.ts CHANGED
@@ -9,8 +9,8 @@ export declare class Day extends DateRange {
9
9
  static fromNow(now: Timestamp): Day;
10
10
  static fromIsoId(isoId: DayIsoIdType): Day;
11
11
  toIsoId(): DayIsoIdType;
12
- next(): Day;
13
12
  previous(): Day;
13
+ next(): Day;
14
14
  shift(count: IntegerType): Day;
15
15
  toString(): string;
16
16
  }
package/dist/day.vo.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { formatISO } from "date-fns";
2
+ import * as v from "valibot";
2
3
  import { DateRange } from "./date-range.vo";
3
4
  import { DayIsoId } from "./day-iso-id.vo";
4
5
  import { Duration } from "./duration.service";
@@ -18,20 +19,20 @@ export class Day extends DateRange {
18
19
  return Day.fromTimestamp(now);
19
20
  }
20
21
  static fromIsoId(isoId) {
21
- const [year, month, day] = DayIsoId.parse(isoId).split("-").map(Number);
22
+ const [year, month, day] = v.parse(DayIsoId, isoId).split("-").map(Number);
22
23
  const startUtc = Timestamp.fromNumber(Date.UTC(year, month - 1, day));
23
24
  const endUtc = startUtc.add(Duration.Days(1)).subtract(Duration.Ms(1));
24
25
  return new Day(startUtc, endUtc);
25
26
  }
26
27
  toIsoId() {
27
28
  const midday = this.getStart().add(Duration.Hours(12));
28
- return DayIsoId.parse(formatISO(midday.ms, { representation: "date" }));
29
- }
30
- next() {
31
- return this.shift(Integer.parse(1));
29
+ return v.parse(DayIsoId, formatISO(midday.ms, { representation: "date" }));
32
30
  }
33
31
  previous() {
34
- return this.shift(Integer.parse(-1));
32
+ return this.shift(v.parse(Integer, -1));
33
+ }
34
+ next() {
35
+ return this.shift(v.parse(Integer, 1));
35
36
  }
36
37
  shift(count) {
37
38
  return Day.fromTimestamp(this.getStart().add(Duration.Days(count)));
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const DirectoryPathAbsoluteError: {
3
3
  BadSegments: string;
4
4
  Empty: string;
@@ -8,5 +8,5 @@ export declare const DirectoryPathAbsoluteError: {
8
8
  Type: string;
9
9
  };
10
10
  export declare const DIRECTORY_PATH_ABSOLUTE_CHARS: RegExp;
11
- export declare const DirectoryPathAbsoluteSchema: z.core.$ZodBranded<z.ZodString, "DirectoryPathAbsoluteSchema", "out">;
12
- export type DirectoryPathAbsoluteType = z.infer<typeof DirectoryPathAbsoluteSchema>;
11
+ export declare const DirectoryPathAbsoluteSchema: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 512, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.BrandAction<string, "DirectoryPathAbsoluteSchema">]>;
12
+ export type DirectoryPathAbsoluteType = v.InferOutput<typeof DirectoryPathAbsoluteSchema>;
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export const DirectoryPathAbsoluteError = {
3
3
  BadSegments: "directory.path.absolue.bad.segments",
4
4
  Empty: "directory.path.absolue.empty",
@@ -10,18 +10,11 @@ export const DirectoryPathAbsoluteError = {
10
10
  // Letters, digits, dots, underscores, and hyphens
11
11
  export const DIRECTORY_PATH_ABSOLUTE_CHARS = /^[a-zA-Z0-9._-]+$/;
12
12
  const DOT_SEGMENTS = [".", ".."];
13
- // Stryker disable all
14
- export const DirectoryPathAbsoluteSchema = z
15
- // Stryker restore all
16
- .string(DirectoryPathAbsoluteError.Type)
17
- .min(1, DirectoryPathAbsoluteError.Empty)
18
- .max(512, DirectoryPathAbsoluteError.TooLong)
19
- .refine((value) => value.startsWith("/"), DirectoryPathAbsoluteError.LeadingSlash)
20
- .refine((value) => (value === "/" ? true : !value.endsWith("/")), DirectoryPathAbsoluteError.TrailingSlash)
21
- .refine((value) => {
13
+ export const DirectoryPathAbsoluteSchema = v.pipe(v.string(DirectoryPathAbsoluteError.Type), v.minLength(1, DirectoryPathAbsoluteError.Empty), v.maxLength(512, DirectoryPathAbsoluteError.TooLong), v.check((value) => value.startsWith("/"), DirectoryPathAbsoluteError.LeadingSlash), v.check((value) => (value === "/" ? true : !value.endsWith("/")), DirectoryPathAbsoluteError.TrailingSlash), v.check((value) => {
22
14
  if (value === "/")
23
15
  return true;
24
16
  const segments = value.slice(1).split("/");
25
17
  return segments.every((segment) => DIRECTORY_PATH_ABSOLUTE_CHARS.test(segment) && !DOT_SEGMENTS.includes(segment));
26
- }, DirectoryPathAbsoluteError.BadSegments)
27
- .brand("DirectoryPathAbsoluteSchema");
18
+ }, DirectoryPathAbsoluteError.BadSegments),
19
+ // Stryker disable next-line StringLiteral
20
+ v.brand("DirectoryPathAbsoluteSchema"));
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const DirectoryPathRelativeError: {
3
3
  BadSegments: string;
4
4
  Empty: string;
@@ -8,5 +8,5 @@ export declare const DirectoryPathRelativeError: {
8
8
  Type: string;
9
9
  };
10
10
  export declare const DIRECTORY_PATH_RELATIVE_CHARS: RegExp;
11
- export declare const DirectoryPathRelativeSchema: z.core.$ZodBranded<z.ZodString, "DirectoryPathRelativeSchema", "out">;
12
- export type DirectoryPathRelativeType = z.infer<typeof DirectoryPathRelativeSchema>;
11
+ export declare const DirectoryPathRelativeSchema: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 512, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.BrandAction<string, "DirectoryPathRelativeSchema">]>;
12
+ export type DirectoryPathRelativeType = v.InferOutput<typeof DirectoryPathRelativeSchema>;
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export const DirectoryPathRelativeError = {
3
3
  BadSegments: "directory.path.relative.bad.segments",
4
4
  Empty: "directory.path.relative.empty",
@@ -10,15 +10,8 @@ export const DirectoryPathRelativeError = {
10
10
  // Letters, digits, dots, underscores, and hyphens
11
11
  export const DIRECTORY_PATH_RELATIVE_CHARS = /^[A-Za-z0-9._-]+$/;
12
12
  const DOT_SEGMENTS = [".", ".."];
13
- // Stryker disable all
14
- export const DirectoryPathRelativeSchema = z
15
- // Stryker restore all
16
- .string(DirectoryPathRelativeError.Type)
17
- .min(1, DirectoryPathRelativeError.Empty)
18
- .max(512, DirectoryPathRelativeError.TooLong)
19
- .refine((value) => !value.startsWith("/"), DirectoryPathRelativeError.LeadingSlash)
20
- .refine((value) => !value.endsWith("/"), DirectoryPathRelativeError.TrailingSlash)
21
- .refine((value) => value
13
+ export const DirectoryPathRelativeSchema = v.pipe(v.string(DirectoryPathRelativeError.Type), v.minLength(1, DirectoryPathRelativeError.Empty), v.maxLength(512, DirectoryPathRelativeError.TooLong), v.check((value) => !value.startsWith("/"), DirectoryPathRelativeError.LeadingSlash), v.check((value) => !value.endsWith("/"), DirectoryPathRelativeError.TrailingSlash), v.check((value) => value
22
14
  .split("/")
23
- .every((segment) => DIRECTORY_PATH_RELATIVE_CHARS.test(segment) && !DOT_SEGMENTS.includes(segment)), DirectoryPathRelativeError.BadSegments)
24
- .brand("DirectoryPathRelativeSchema");
15
+ .every((segment) => DIRECTORY_PATH_RELATIVE_CHARS.test(segment) && !DOT_SEGMENTS.includes(segment)), DirectoryPathRelativeError.BadSegments),
16
+ // Stryker disable next-line StringLiteral
17
+ v.brand("DirectoryPathRelativeSchema"));
@@ -1,7 +1,7 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const DistanceValueError: {
3
3
  Type: string;
4
4
  Invalid: string;
5
5
  };
6
- export declare const DistanceValue: z.core.$ZodBranded<z.ZodNumber, "DistanceValue", "out">;
7
- export type DistanceValueType = z.infer<typeof DistanceValue>;
6
+ export declare const DistanceValue: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "DistanceValue">]>;
7
+ export type DistanceValueType = v.InferOutput<typeof DistanceValue>;
@@ -1,9 +1,5 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export const DistanceValueError = { Type: "distance.value.type", Invalid: "distance.value.invalid" };
3
- // Stryker disable all
4
- export const DistanceValue = z
5
- // Stryker restore all
6
- .number(DistanceValueError.Type)
7
- .int(DistanceValueError.Type)
8
- .min(0, DistanceValueError.Invalid)
9
- .brand("DistanceValue");
3
+ export const DistanceValue = v.pipe(v.number(DistanceValueError.Type), v.integer(DistanceValueError.Type), v.minValue(0, DistanceValueError.Invalid),
4
+ // Stryker disable next-line StringLiteral
5
+ v.brand("DistanceValue"));
@@ -1,35 +1,36 @@
1
+ import * as v from "valibot";
1
2
  import { DistanceValue } from "./distance-value.vo";
2
3
  import { RoundingToNearestStrategy } from "./rounding-to-nearest.strategy";
3
4
  export const DistanceError = { SubtractResultLessThanZero: "distance.subtract.result.less.than.zero" };
4
5
  export class Distance {
5
6
  value;
6
- static ZERO = DistanceValue.parse(0);
7
+ static ZERO = v.parse(DistanceValue, 0);
7
8
  constructor(value) {
8
9
  this.value = value;
9
10
  }
10
11
  static fromMeters(candidate) {
11
- return new Distance(DistanceValue.parse(candidate));
12
+ return new Distance(v.parse(DistanceValue, candidate));
12
13
  }
13
14
  static fromMetersSafe(candidate) {
14
15
  return new Distance(candidate);
15
16
  }
16
17
  static fromKilometers(candidate, rounding = new RoundingToNearestStrategy()) {
17
- return new Distance(DistanceValue.parse(rounding.round(candidate * 1000)));
18
+ return new Distance(v.parse(DistanceValue, rounding.round(candidate * 1000)));
18
19
  }
19
20
  static fromMiles(candidate, rounding = new RoundingToNearestStrategy()) {
20
- return new Distance(DistanceValue.parse(rounding.round(candidate * 1_609.344)));
21
+ return new Distance(v.parse(DistanceValue, rounding.round(candidate * 1_609.344)));
21
22
  }
22
23
  get() {
23
24
  return this.value;
24
25
  }
25
26
  add(distance) {
26
- return new Distance(DistanceValue.parse(this.value + distance.get()));
27
+ return new Distance(v.parse(DistanceValue, this.value + distance.get()));
27
28
  }
28
29
  subtract(distance) {
29
30
  const result = this.value - distance.get();
30
31
  if (result < Distance.ZERO)
31
32
  throw new Error(DistanceError.SubtractResultLessThanZero);
32
- return new Distance(DistanceValue.parse(result));
33
+ return new Distance(v.parse(DistanceValue, result));
33
34
  }
34
35
  equals(another) {
35
36
  return this.value === another.get();
@@ -1,7 +1,7 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const DivisionFactorError: {
3
3
  Type: string;
4
4
  Invalid: string;
5
5
  };
6
- export declare const DivisionFactor: z.core.$ZodBranded<z.ZodNumber, "DivisionFactor", "out">;
7
- export type DivisionFactorType = z.infer<typeof DivisionFactor>;
6
+ export declare const DivisionFactor: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.GtValueAction<number, 0, string>, v.BrandAction<number, "DivisionFactor">]>;
7
+ export type DivisionFactorType = v.InferOutput<typeof DivisionFactor>;
@@ -1,8 +1,5 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export const DivisionFactorError = { Type: "division.factor.type", Invalid: "division.factor.invalid" };
3
- // Stryker disable all
4
- export const DivisionFactor = z
5
- // Stryker restore all
6
- .number(DivisionFactorError.Type)
7
- .gt(0, DivisionFactorError.Invalid)
8
- .brand("DivisionFactor");
3
+ export const DivisionFactor = v.pipe(v.number(DivisionFactorError.Type), v.gtValue(0, DivisionFactorError.Invalid),
4
+ // Stryker disable next-line StringLiteral
5
+ v.brand("DivisionFactor"));
@@ -1,6 +1,6 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const DurationMsError: {
3
3
  Invalid: string;
4
4
  };
5
- export declare const DurationMs: z.core.$ZodBranded<z.ZodNumber, "DurationMs", "out">;
6
- export type DurationMsType = z.infer<typeof DurationMs>;
5
+ export declare const DurationMs: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.BrandAction<number, "DurationMs">]>;
6
+ export type DurationMsType = v.InferOutput<typeof DurationMs>;
@@ -1,4 +1,5 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export const DurationMsError = { Invalid: "duration.invalid" };
3
- // Stryker disable all
4
- export const DurationMs = z.number(DurationMsError.Invalid).int(DurationMsError.Invalid).brand("DurationMs");
3
+ export const DurationMs = v.pipe(v.number(DurationMsError.Invalid), v.integer(DurationMsError.Invalid),
4
+ // Stryker disable next-line StringLiteral
5
+ v.brand("DurationMs"));
@@ -1,3 +1,4 @@
1
+ import * as v from "valibot";
1
2
  import { DurationMs } from "./duration-ms.vo";
2
3
  import { RoundingDecimalStrategy } from "./rounding-decimal.strategy";
3
4
  import { RoundingToNearestStrategy } from "./rounding-to-nearest.strategy";
@@ -12,7 +13,7 @@ export class Duration {
12
13
  static MS_IN_DAY = 24 * Duration.MS_IN_HOUR;
13
14
  static MS_IN_WEEK = 7 * Duration.MS_IN_DAY;
14
15
  constructor(candidateMs) {
15
- this.internal = DurationMs.parse(candidateMs);
16
+ this.internal = v.parse(DurationMs, candidateMs);
16
17
  }
17
18
  static Weeks(value) {
18
19
  return new Duration(value * Duration.MS_IN_WEEK);
@@ -1,6 +1,6 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const EmailError: {
3
3
  Invalid: string;
4
4
  };
5
- export declare const Email: z.core.$ZodBranded<z.ZodEmail, "Email", "out">;
6
- export type EmailType = z.infer<typeof Email>;
5
+ export declare const Email: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.EmailAction<string, string>, v.BrandAction<string, "Email">]>;
6
+ export type EmailType = v.InferOutput<typeof Email>;
package/dist/email.vo.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export const EmailError = { Invalid: "email.invalid" };
3
- // Stryker disable all
4
- export const Email = z.email(EmailError.Invalid).brand("Email");
3
+ // Stryker disable next-line StringLiteral
4
+ export const Email = v.pipe(v.string(EmailError.Invalid), v.email(EmailError.Invalid), v.brand("Email"));
package/dist/etags.vo.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as v from "valibot";
1
2
  import { RevisionValue } from "./revision-value.vo";
2
3
  export class ETag {
3
4
  revision;
@@ -12,7 +13,7 @@ export class ETag {
12
13
  const candidate = Number(value);
13
14
  if (Number.isNaN(candidate))
14
15
  return null;
15
- return new ETag(RevisionValue.parse(candidate));
16
+ return new ETag(v.parse(RevisionValue, candidate));
16
17
  }
17
18
  }
18
19
  export const WeakETagError = { Invalid: "weak.etag.invalid" };
@@ -31,6 +32,6 @@ export class WeakETag {
31
32
  const candidate = Number(value.split("W/")[1]);
32
33
  if (Number.isNaN(candidate))
33
34
  return null;
34
- return new WeakETag(RevisionValue.parse(candidate));
35
+ return new WeakETag(v.parse(RevisionValue, candidate));
35
36
  }
36
37
  }
@@ -1,9 +1,9 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const ExtensionError: {
3
3
  Type: string;
4
4
  Empty: string;
5
5
  TooLong: string;
6
6
  BadChars: string;
7
7
  };
8
- export declare const Extension: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "Extension", "out">;
9
- export type ExtensionType = z.infer<typeof Extension>;
8
+ export declare const Extension: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.ToLowerCaseAction, v.TransformAction<string, string>, v.MinLengthAction<string, 2, string>, v.MaxLengthAction<string, 16, string>, v.CheckAction<string, string>, v.BrandAction<string, "Extension">]>;
9
+ export type ExtensionType = v.InferOutput<typeof Extension>;
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export const ExtensionError = {
3
3
  Type: "extension.type",
4
4
  Empty: "extension.empty",
@@ -8,14 +8,8 @@ export const ExtensionError = {
8
8
  // Lowercase letters and digits allowed
9
9
  const EXTENSION_WHITELIST = /^[a-z0-9]+$/;
10
10
  const LEADING_DOT_FILE = /^\./;
11
- // Stryker disable all
12
- export const Extension = z
13
- // Stryker restore all
14
- .string(ExtensionError.Type)
15
- .toLowerCase()
16
- .min(2, ExtensionError.Empty)
17
- .max(16, ExtensionError.TooLong)
18
- // Transform ".png" -> "png"
19
- .transform((value) => value.replace(LEADING_DOT_FILE, ""))
20
- .refine((value) => EXTENSION_WHITELIST.test(value), ExtensionError.BadChars)
21
- .brand("Extension");
11
+ export const Extension = v.pipe(v.string(ExtensionError.Type), v.toLowerCase(),
12
+ // Transform ".png" -> "png"
13
+ v.transform((value) => value.replace(LEADING_DOT_FILE, "")), v.minLength(2, ExtensionError.Empty), v.maxLength(16, ExtensionError.TooLong), v.check((value) => EXTENSION_WHITELIST.test(value), ExtensionError.BadChars),
14
+ // Stryker disable next-line StringLiteral
15
+ v.brand("Extension"));
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export declare const FeatureFlagValueError: {
3
3
  Invalid: string;
4
4
  };
@@ -6,5 +6,5 @@ export declare enum FeatureFlagEnum {
6
6
  yes = "yes",
7
7
  no = "no"
8
8
  }
9
- export declare const FeatureFlagValue: z.ZodEnum<typeof FeatureFlagEnum>;
10
- export type FeatureFlagValueType = z.infer<typeof FeatureFlagValue>;
9
+ export declare const FeatureFlagValue: v.PicklistSchema<FeatureFlagEnum[], string>;
10
+ export type FeatureFlagValueType = v.InferOutput<typeof FeatureFlagValue>;
@@ -1,8 +1,8 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  export const FeatureFlagValueError = { Invalid: "feature.flag.value.invalid" };
3
3
  export var FeatureFlagEnum;
4
4
  (function (FeatureFlagEnum) {
5
5
  FeatureFlagEnum["yes"] = "yes";
6
6
  FeatureFlagEnum["no"] = "no";
7
7
  })(FeatureFlagEnum || (FeatureFlagEnum = {}));
8
- export const FeatureFlagValue = z.enum(FeatureFlagEnum, FeatureFlagValueError.Invalid);
8
+ export const FeatureFlagValue = v.picklist(Object.values(FeatureFlagEnum), FeatureFlagValueError.Invalid);
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  import { Filename } from "./filename.vo";
3
3
  export declare const FilePathAbsoluteSchemaError: {
4
4
  Type: string;
@@ -7,8 +7,11 @@ export declare const FilePathAbsoluteSchemaError: {
7
7
  BackslashForbidden: string;
8
8
  Empty: string;
9
9
  };
10
- export declare const FilePathAbsoluteSchema: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<{
11
- directory: string & z.core.$brand<"DirectoryPathAbsoluteSchema">;
10
+ export declare const FilePathAbsoluteSchema: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.TransformAction<string, {
11
+ directory: string & v.Brand<"DirectoryPathAbsoluteSchema">;
12
12
  filename: Filename;
13
- }, string>>, "FilePathAbsoluteSchema", "out">;
14
- export type FilePathAbsoluteType = z.infer<typeof FilePathAbsoluteSchema>;
13
+ }>, v.BrandAction<{
14
+ directory: string & v.Brand<"DirectoryPathAbsoluteSchema">;
15
+ filename: Filename;
16
+ }, "FilePathAbsoluteSchema">]>;
17
+ export type FilePathAbsoluteType = v.InferOutput<typeof FilePathAbsoluteSchema>;
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  import { DirectoryPathAbsoluteSchema } from "./directory-path-absolute.vo";
3
3
  import { Filename } from "./filename.vo";
4
4
  export const FilePathAbsoluteSchemaError = {
@@ -8,20 +8,13 @@ export const FilePathAbsoluteSchemaError = {
8
8
  BackslashForbidden: "file.path.absolute.backslash.forbidden",
9
9
  Empty: "file.path.absolute.empty",
10
10
  };
11
- // Stryker disable all
12
- export const FilePathAbsoluteSchema = z
13
- // Stryker restore all
14
- .string(FilePathAbsoluteSchemaError.Type)
15
- .min(1, FilePathAbsoluteSchemaError.Empty)
16
- .refine((value) => value.startsWith("/"), FilePathAbsoluteSchemaError.LeadingSlash)
17
- .refine((value) => !value.endsWith("/"), FilePathAbsoluteSchemaError.TrailingSlash)
18
- .refine((value) => !value.includes("\\"), FilePathAbsoluteSchemaError.BackslashForbidden)
19
- .transform((normalized) => {
11
+ export const FilePathAbsoluteSchema = v.pipe(v.string(FilePathAbsoluteSchemaError.Type), v.minLength(1, FilePathAbsoluteSchemaError.Empty), v.check((value) => value.startsWith("/"), FilePathAbsoluteSchemaError.LeadingSlash), v.check((value) => !value.endsWith("/"), FilePathAbsoluteSchemaError.TrailingSlash), v.check((value) => !value.includes("\\"), FilePathAbsoluteSchemaError.BackslashForbidden), v.transform((normalized) => {
20
12
  const index = normalized.lastIndexOf("/");
21
13
  const directoryCandidate = index === 0 ? "/" : normalized.slice(0, index);
22
14
  const filenameCandidate = normalized.slice(index + 1);
23
- const directory = DirectoryPathAbsoluteSchema.parse(directoryCandidate);
15
+ const directory = v.parse(DirectoryPathAbsoluteSchema, directoryCandidate);
24
16
  const filename = Filename.fromString(filenameCandidate);
25
17
  return { directory, filename };
26
- })
27
- .brand("FilePathAbsoluteSchema");
18
+ }),
19
+ // Stryker disable next-line StringLiteral
20
+ v.brand("FilePathAbsoluteSchema"));
@@ -1,4 +1,4 @@
1
- import * as z from "zod/v4";
1
+ import * as v from "valibot";
2
2
  import { Filename } from "./filename.vo";
3
3
  export declare const FilePathRelativeSchemaError: {
4
4
  Type: string;
@@ -7,8 +7,11 @@ export declare const FilePathRelativeSchemaError: {
7
7
  RequiresDirectory: string;
8
8
  Empty: string;
9
9
  };
10
- export declare const FilePathRelativeSchema: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<{
11
- directory: string & z.core.$brand<"DirectoryPathRelativeSchema">;
10
+ export declare const FilePathRelativeSchema: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.TransformAction<string, {
11
+ directory: string & v.Brand<"DirectoryPathRelativeSchema">;
12
12
  filename: Filename;
13
- }, string>>, "FilePathRelativeSchema", "out">;
14
- export type FilePathRelativeType = z.infer<typeof FilePathRelativeSchema>;
13
+ }>, v.BrandAction<{
14
+ directory: string & v.Brand<"DirectoryPathRelativeSchema">;
15
+ filename: Filename;
16
+ }, "FilePathRelativeSchema">]>;
17
+ export type FilePathRelativeType = v.InferOutput<typeof FilePathRelativeSchema>;