@bgord/tools 1.2.0 → 1.2.2

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 (117) hide show
  1. package/dist/age-years.vo.d.ts +2 -2
  2. package/dist/age.vo.d.ts +1 -1
  3. package/dist/api-key.vo.d.ts +3 -3
  4. package/dist/api-key.vo.js +1 -5
  5. package/dist/basename.vo.d.ts +7 -7
  6. package/dist/date-range.vo.d.ts +1 -1
  7. package/dist/day-iso-id.vo.d.ts +3 -3
  8. package/dist/directory-path-absolute.vo.d.ts +6 -6
  9. package/dist/directory-path-relative.vo.d.ts +6 -6
  10. package/dist/distance.vo.d.ts +1 -1
  11. package/dist/distance.vo.js +1 -3
  12. package/dist/division-factor.vo.d.ts +2 -2
  13. package/dist/division-factor.vo.js +1 -4
  14. package/dist/duration-ms.vo.d.ts +1 -1
  15. package/dist/email.vo.d.ts +1 -1
  16. package/dist/etags.vo.d.ts +1 -1
  17. package/dist/extension.vo.d.ts +4 -4
  18. package/dist/feature-flag-value.vo.d.ts +1 -1
  19. package/dist/file-path-absolute-schema.vo.d.ts +5 -5
  20. package/dist/file-path-relative-schema.vo.d.ts +5 -5
  21. package/dist/filename-affix.vo.d.ts +4 -4
  22. package/dist/filename-from-string.vo.d.ts +2 -2
  23. package/dist/height-milimiters.vo.d.ts +2 -2
  24. package/dist/iban-schema.vo.d.ts +2 -2
  25. package/dist/image.vo.d.ts +4 -4
  26. package/dist/language.vo.d.ts +2 -2
  27. package/dist/linear-regression.service.d.ts +6 -6
  28. package/dist/mean.service.d.ts +1 -1
  29. package/dist/mime.vo.d.ts +1 -1
  30. package/dist/min-max-scaler.service.d.ts +5 -5
  31. package/dist/money.vo.d.ts +1 -1
  32. package/dist/month-iso-id.vo.d.ts +3 -3
  33. package/dist/multiplication-factor.vo.d.ts +2 -2
  34. package/dist/object-key.vo.d.ts +6 -6
  35. package/dist/outlier-detector.service.d.ts +1 -1
  36. package/dist/package-version-schema.vo.d.ts +2 -2
  37. package/dist/pagination-page.vo.d.ts +1 -1
  38. package/dist/pagination-skip.vo.d.ts +2 -2
  39. package/dist/pagination-skip.vo.js +1 -4
  40. package/dist/pagination-take.vo.d.ts +2 -2
  41. package/dist/pagination-take.vo.js +1 -4
  42. package/dist/percentage.service.d.ts +1 -1
  43. package/dist/population-standard-deviation.service.d.ts +1 -1
  44. package/dist/quarter-iso-id.vo.d.ts +2 -2
  45. package/dist/random.service.d.ts +1 -1
  46. package/dist/reordering-item-position-value.vo.d.ts +1 -1
  47. package/dist/revision-value.vo.d.ts +2 -2
  48. package/dist/revision.vo.d.ts +2 -2
  49. package/dist/rounding.adapter.d.ts +2 -2
  50. package/dist/rounding.adapter.js +1 -4
  51. package/dist/size-bytes.vo.d.ts +1 -1
  52. package/dist/stopwatch.service.d.ts +1 -1
  53. package/dist/timestamp-value.vo.d.ts +1 -1
  54. package/dist/timezone.vo.d.ts +4 -4
  55. package/dist/url-with-slash.vo.d.ts +1 -1
  56. package/dist/url-without-slash.vo.d.ts +1 -1
  57. package/dist/week-iso-id.vo.d.ts +3 -3
  58. package/dist/weight-grams.vo.d.ts +2 -2
  59. package/dist/year-iso-id.vo.d.ts +2 -2
  60. package/dist/z-score.service.d.ts +1 -1
  61. package/package.json +7 -6
  62. package/src/age-years.vo.ts +1 -1
  63. package/src/age.vo.ts +1 -1
  64. package/src/api-key.vo.ts +1 -5
  65. package/src/basename.vo.ts +1 -1
  66. package/src/clock-format.service.ts +1 -1
  67. package/src/date-range.vo.ts +1 -1
  68. package/src/day-iso-id.vo.ts +1 -1
  69. package/src/directory-path-absolute.vo.ts +1 -1
  70. package/src/directory-path-relative.vo.ts +1 -1
  71. package/src/distance.vo.ts +1 -3
  72. package/src/division-factor.vo.ts +1 -4
  73. package/src/duration-ms.vo.ts +1 -1
  74. package/src/email.vo.ts +1 -1
  75. package/src/etags.vo.ts +1 -1
  76. package/src/extension.vo.ts +1 -1
  77. package/src/feature-flag-value.vo.ts +1 -1
  78. package/src/file-path-absolute-schema.vo.ts +1 -1
  79. package/src/file-path-relative-schema.vo.ts +1 -1
  80. package/src/filename-affix.vo.ts +1 -1
  81. package/src/filename-from-string.vo.ts +1 -1
  82. package/src/height-milimiters.vo.ts +1 -1
  83. package/src/iban-schema.vo.ts +1 -1
  84. package/src/image.vo.ts +2 -2
  85. package/src/language.vo.ts +1 -1
  86. package/src/linear-regression.service.ts +1 -1
  87. package/src/mean.service.ts +1 -1
  88. package/src/mime.vo.ts +1 -1
  89. package/src/min-max-scaler.service.ts +1 -1
  90. package/src/money.vo.ts +1 -1
  91. package/src/month-iso-id.vo.ts +1 -1
  92. package/src/multiplication-factor.vo.ts +1 -1
  93. package/src/object-key.vo.ts +1 -1
  94. package/src/outlier-detector.service.ts +1 -1
  95. package/src/package-version-schema.vo.ts +1 -1
  96. package/src/pagination-page.vo.ts +1 -1
  97. package/src/pagination-skip.vo.ts +1 -4
  98. package/src/pagination-take.vo.ts +1 -4
  99. package/src/percentage.service.ts +1 -1
  100. package/src/population-standard-deviation.service.ts +1 -1
  101. package/src/quarter-iso-id.vo.ts +1 -1
  102. package/src/random.service.ts +1 -1
  103. package/src/reordering-item-position-value.vo.ts +1 -1
  104. package/src/reordering.service.ts +1 -1
  105. package/src/revision-value.vo.ts +1 -1
  106. package/src/revision.vo.ts +1 -1
  107. package/src/rounding.adapter.ts +1 -4
  108. package/src/size-bytes.vo.ts +1 -1
  109. package/src/stopwatch.service.ts +1 -1
  110. package/src/timestamp-value.vo.ts +1 -1
  111. package/src/timezone.vo.ts +1 -1
  112. package/src/url-with-slash.vo.ts +1 -1
  113. package/src/url-without-slash.vo.ts +1 -1
  114. package/src/week-iso-id.vo.ts +1 -1
  115. package/src/weight-grams.vo.ts +1 -1
  116. package/src/year-iso-id.vo.ts +1 -1
  117. package/src/z-score.service.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  import type { Duration } from "./duration.service";
2
2
  import { Timestamp } from "./timestamp.vo";
3
3
  export declare const StopwatchError: {
4
- readonly AlreadyStopped: "stopwatch.already.stopped";
4
+ AlreadyStopped: string;
5
5
  };
6
6
  export type StopwatchResultType = Duration;
7
7
  export declare class Stopwatch {
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
  export declare const TimestampValueError: {
3
- readonly Invalid: "timestamp.invalid";
3
+ Invalid: string;
4
4
  };
5
5
  export declare const TimestampValue: z.core.$ZodBranded<z.ZodNumber, "TimestampValue">;
6
6
  export type TimestampValueType = z.infer<typeof TimestampValue>;
@@ -1,9 +1,9 @@
1
1
  import { z } from "zod/v4";
2
2
  export declare const TimezoneError: {
3
- readonly Type: "timezone.type";
4
- readonly Empty: "timezone.empty";
5
- readonly TooLong: "timezone.too.long";
6
- readonly Invalid: "timezone.invalid";
3
+ Type: string;
4
+ Empty: string;
5
+ TooLong: string;
6
+ Invalid: string;
7
7
  };
8
8
  export declare const Timezone: z.core.$ZodBranded<z.ZodString, "Timezone">;
9
9
  export type TimezoneType = z.infer<typeof Timezone>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
  export declare const UrlWithSlashError: {
3
- readonly Invalid: "url.with.slash.invalid";
3
+ Invalid: string;
4
4
  };
5
5
  export declare const UrlWithSlash: z.core.$ZodBranded<z.ZodURL, "UrlWithSlash">;
6
6
  export type UrlWithSlashType = z.infer<typeof UrlWithSlash>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
  export declare const UrlWithoutSlashError: {
3
- readonly Invalid: "url.without.slash.invalid";
3
+ Invalid: string;
4
4
  };
5
5
  export declare const UrlWithoutSlash: z.core.$ZodBranded<z.ZodURL, "UrlWithoutSlash">;
6
6
  export type UrlWithoutSlashType = z.infer<typeof UrlWithoutSlash>;
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod/v4";
2
2
  export declare const WeekIsoIdError: {
3
- readonly Type: "week.iso.id.type";
4
- readonly BadChars: "week.iso.id.bad.chars";
5
- readonly Invalid: "week.iso.id.invalid";
3
+ Type: string;
4
+ BadChars: string;
5
+ Invalid: string;
6
6
  };
7
7
  export declare const WeekIsoId: z.core.$ZodBranded<z.ZodString, "WeekIsoId">;
8
8
  export type WeekIsoIdType = z.infer<typeof WeekIsoId>;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod/v4";
2
2
  export declare const WeightGramsError: {
3
- readonly Type: "weight.grams.type";
4
- readonly Invalid: "weight.grams.invalid";
3
+ Type: string;
4
+ Invalid: string;
5
5
  };
6
6
  export declare const WeightGrams: z.core.$ZodBranded<z.ZodNumber, "WeightGrams">;
7
7
  export type WeightGramsType = z.infer<typeof WeightGrams>;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod/v4";
2
2
  export declare const YearIsoIdError: {
3
- readonly Type: "year.iso.id.type";
4
- readonly BadChars: "year.iso.id.bad.chars";
3
+ Type: string;
4
+ BadChars: string;
5
5
  };
6
6
  export declare const YearIsoId: z.core.$ZodBranded<z.ZodString, "YearIsoId">;
7
7
  export type YearIsoIdType = z.infer<typeof YearIsoId>;
@@ -1,6 +1,6 @@
1
1
  import type { RoundingPort } from "./rounding.port";
2
2
  export declare const ZScoreError: {
3
- readonly NotEnoughValues: "z.score.not.enough.values";
3
+ NotEnoughValues: string;
4
4
  };
5
5
  export declare class ZScore {
6
6
  private readonly rounding;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgord/tools",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Bartosz Gordon",
@@ -21,25 +21,26 @@
21
21
  "preinstall": "bunx only-allow bun"
22
22
  },
23
23
  "devDependencies": {
24
- "@biomejs/biome": "2.3.8",
24
+ "@biomejs/biome": "2.3.9",
25
25
  "@commitlint/cli": "20.2.0",
26
26
  "@commitlint/config-conventional": "20.2.0",
27
27
  "@types/bun": "1.3.4",
28
28
  "@types/mime-types": "3.0.1",
29
29
  "cspell": "9.4.0",
30
- "knip": "5.73.4",
31
- "lefthook": "2.0.11",
30
+ "knip": "5.74.0",
31
+ "lefthook": "2.0.12",
32
+ "lockfile-lint": "4.14.1",
32
33
  "only-allow": "1.2.2",
33
34
  "shellcheck": "4.1.0",
34
35
  "typescript": "5.9.3",
35
- "zod": "4.1.13"
36
+ "zod": "4.2.1"
36
37
  },
37
38
  "dependencies": {
38
39
  "date-fns": "4.1.0",
39
40
  "mime-types": "3.0.2"
40
41
  },
41
42
  "peerDependencies": {
42
- "zod": "4.1.13"
43
+ "zod": "4.2.1"
43
44
  },
44
45
  "sideEffects": false
45
46
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const AgeYearsError = { Type: "age.years.type", Invalid: "age.years.invalid" } as const;
3
+ export const AgeYearsError = { Type: "age.years.type", Invalid: "age.years.invalid" };
4
4
 
5
5
  export const AgeYearsConstraints = { min: 1, max: 130 };
6
6
 
package/src/age.vo.ts CHANGED
@@ -2,7 +2,7 @@ import { differenceInYears } from "date-fns";
2
2
  import { AgeYears, AgeYearsConstraints, type AgeYearsType } from "./age-years.vo";
3
3
  import { Timestamp } from "./timestamp.vo";
4
4
 
5
- export const AgeError = { FutureBirthdate: "age.future.birthdate" } as const;
5
+ export const AgeError = { FutureBirthdate: "age.future.birthdate" };
6
6
 
7
7
  export class Age {
8
8
  static readonly MIN = AgeYearsConstraints.min;
package/src/api-key.vo.ts CHANGED
@@ -1,10 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const ApiKeyError = {
4
- Type: "api.key.type",
5
- Length: "api.key.length",
6
- BadChars: "api.key.bad.chars",
7
- } as const;
3
+ export const ApiKeyError = { Type: "api.key.type", Length: "api.key.length", BadChars: "api.key.bad.chars" };
8
4
 
9
5
  // 64 letters and digits allowed
10
6
  const API_KEY_CHARS = /^[a-zA-Z0-9]{64}$/;
@@ -8,7 +8,7 @@ export const BasenameError = {
8
8
  Dotfiles: "basename.dotfiles",
9
9
  TrailingDot: "basename.trailing.dot",
10
10
  BadChars: "basename.bad.chars",
11
- } as const;
11
+ };
12
12
 
13
13
  // Letters, digits, dots, underscores, and hyphens allowed
14
14
  const BASENAME_CHARS = /^[a-zA-Z0-9._-]+$/;
@@ -12,4 +12,4 @@ enum ClockFormatterEnum {
12
12
  export const ClockFormatters: Record<ClockFormatterEnum, ClockFormatter> = {
13
13
  TWENTY_FOUR_HOURS: (hour, minute) => `${hour.toString()}:${minute.toString()}`,
14
14
  TWELVE_HOURS: (hour, minute) => `${hour.format(HourFormatters.TWELVE_HOURS)}:${minute.toString()}`,
15
- } as const;
15
+ };
@@ -1,6 +1,6 @@
1
1
  import type { Timestamp } from "./timestamp.vo";
2
2
 
3
- export const DateRangeError = { Invalid: "date.range.invalid" } as const;
3
+ export const DateRangeError = { Invalid: "date.range.invalid" };
4
4
 
5
5
  export class DateRange {
6
6
  constructor(
@@ -5,7 +5,7 @@ export const DayIsoIdError = {
5
5
  Type: "day.iso.id.type",
6
6
  BadChars: "day.iso.id.bad.chars",
7
7
  InvalidDate: "day.iso.id.invalid.date",
8
- } as const;
8
+ };
9
9
 
10
10
  // Four digits, hyphen, two digits, hyphen, two digits
11
11
  export const DAY_ISO_ID_CHARS = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
@@ -7,7 +7,7 @@ export const DirectoryPathAbsoluteError = {
7
7
  TooLong: "directory.path.absolue.too.long",
8
8
  TrailingSlash: "directory.path.absolue.trailing.slash",
9
9
  Type: "directory.path.absolue.type",
10
- } as const;
10
+ };
11
11
 
12
12
  // Letters, digits, dots, underscores, and hyphens
13
13
  export const DIRECTORY_PATH_ABSOLUTE_CHARS = /^[a-zA-Z0-9._-]+$/;
@@ -7,7 +7,7 @@ export const DirectoryPathRelativeError = {
7
7
  TooLong: "directory.path.absolue.too.long",
8
8
  TrailingSlash: "directory.path.absolue.trailing.slash",
9
9
  Type: "directory.path.relative.not.type",
10
- } as const;
10
+ };
11
11
 
12
12
  // Letters, digits, dots, underscores, and hyphens
13
13
  export const DIRECTORY_PATH_RELATIVE_CHARS = /^[A-Za-z0-9._-]+$/;
@@ -2,9 +2,7 @@ import { DistanceValue, type DistanceValueType } from "./distance-value.vo";
2
2
  import { RoundToNearest } from "./rounding.adapter";
3
3
  import type { RoundingPort } from "./rounding.port";
4
4
 
5
- export const DistanceError = {
6
- SubtractResultLessThanZero: "distance.subtract.result.less.than.zero",
7
- } as const;
5
+ export const DistanceError = { SubtractResultLessThanZero: "distance.subtract.result.less.than.zero" };
8
6
 
9
7
  export class Distance {
10
8
  private static readonly ZERO = DistanceValue.parse(0);
@@ -1,9 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const DivisionFactorError = {
4
- Type: "division.factor.type",
5
- Invalid: "division.factor.invalid",
6
- } as const;
3
+ export const DivisionFactorError = { Type: "division.factor.type", Invalid: "division.factor.invalid" };
7
4
 
8
5
  export const DivisionFactor = z
9
6
  .number(DivisionFactorError.Type)
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const DurationMsError = { Invalid: "duration.invalid" } as const;
3
+ export const DurationMsError = { Invalid: "duration.invalid" };
4
4
 
5
5
  export const DurationMs = z.number(DurationMsError.Invalid).int(DurationMsError.Invalid).brand("DurationMs");
6
6
 
package/src/email.vo.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const EmailError = { Invalid: "email.invalid" } as const;
3
+ export const EmailError = { Invalid: "email.invalid" };
4
4
 
5
5
  export const Email = z.email({ error: EmailError.Invalid }).brand("Email");
6
6
 
package/src/etags.vo.ts CHANGED
@@ -25,7 +25,7 @@ export class ETag {
25
25
 
26
26
  export type WeakETagValueType = string;
27
27
 
28
- export const WeakETagError = { Invalid: "weak.etag.invalid" } as const;
28
+ export const WeakETagError = { Invalid: "weak.etag.invalid" };
29
29
 
30
30
  export class WeakETag {
31
31
  static HEADER_NAME = "ETag";
@@ -5,7 +5,7 @@ export const ExtensionError = {
5
5
  Empty: "extension.empty",
6
6
  TooLong: "extension.too.long",
7
7
  BadChars: "extension.bad.chars",
8
- } as const;
8
+ };
9
9
 
10
10
  // Lowercase letters and digits allowed
11
11
  const EXTENSION_WHITELIST = /^[a-z0-9]+$/;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const FeatureFlagValueError = { Invalid: "feature.flag.value.invalid" } as const;
3
+ export const FeatureFlagValueError = { Invalid: "feature.flag.value.invalid" };
4
4
 
5
5
  export enum FeatureFlagEnum {
6
6
  yes = "yes",
@@ -8,7 +8,7 @@ export const FilePathAbsoluteSchemaError = {
8
8
  TrailingSlash: "file.path.absolute.trailing.slash",
9
9
  BackslashForbidden: "file.path.absolute.backslash.forbidden",
10
10
  Empty: "file.path.absolute.empty",
11
- } as const;
11
+ };
12
12
 
13
13
  export const FilePathAbsoluteSchema = z
14
14
  .string(FilePathAbsoluteSchemaError.Type)
@@ -8,7 +8,7 @@ export const FilePathRelativeSchemaError = {
8
8
  BackslashForbidden: "file.path.relative.backslash.forbidden",
9
9
  RequiresDirectory: "file.path.relative.requires.directory",
10
10
  Empty: "file.path.relative.empty",
11
- } as const;
11
+ };
12
12
 
13
13
  export const FilePathRelativeSchema = z
14
14
  .string(FilePathRelativeSchemaError.Type)
@@ -10,7 +10,7 @@ export const FilenameAffixError = {
10
10
  Empty: "affix.empty",
11
11
  TooLong: "affix.too.long",
12
12
  BadChars: "affix.bad.chars",
13
- } as const;
13
+ };
14
14
 
15
15
  // Letters, digits, underscores, and hyphens allowed
16
16
  const FILENAME_AFFIX_WHITELIST = /^[a-zA-Z0-9_-]+$/;
@@ -5,7 +5,7 @@ import { Extension } from "./extension.vo";
5
5
  export const FilenameFromStringError = {
6
6
  Type: "filename.from.string.type",
7
7
  Invalid: "filename.from.string.Invalid",
8
- } as const;
8
+ };
9
9
 
10
10
  // .+ at least one character, advances to the last dot
11
11
  // .
@@ -3,7 +3,7 @@ import { z } from "zod/v4";
3
3
  export const HeightMillimetersError = {
4
4
  Type: "height.millimeters.type",
5
5
  Invalid: "height.millimeters.invalid",
6
- } as const;
6
+ };
7
7
 
8
8
  export const HeightMillimeters = z
9
9
  .number(HeightMillimetersError.Type)
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const IbanSchemaError = { Type: "iban.schema.type", Invalid: "iban.schema.invalid" } as const;
3
+ export const IbanSchemaError = { Type: "iban.schema.type", Invalid: "iban.schema.invalid" };
4
4
 
5
5
  // Two letters for country code, two digits, 11–30 uppercase letters or digits
6
6
  const IBAN_CHARS_WHITELIST = /^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/;
package/src/image.vo.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const ImageWidthError = { Type: "image.width.type", Length: "image.width.length" } as const;
4
- export const ImageHeightError = { Type: "image.height.type", Length: "image.height.length" } as const;
3
+ export const ImageWidthError = { Type: "image.width.type", Length: "image.width.length" };
4
+ export const ImageHeightError = { Type: "image.height.type", Length: "image.height.length" };
5
5
 
6
6
  const IMAGE_DIMENSIONS_CONSTRAINTS = { min: 1, max: 10_000 };
7
7
 
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const LanguageError = { Type: "language.type", BadChars: "language.bad.chars" } as const;
3
+ export const LanguageError = { Type: "language.type", BadChars: "language.bad.chars" };
4
4
 
5
5
  // Two lowercase letters
6
6
  const LANGUAGE_CHARS_WHITELIST = /^[a-z]{2}$/;
@@ -12,7 +12,7 @@ export const LinearRegressionError = {
12
12
  SumXSquaredTooBig: "linear.regression.sum.x.squared.too.big",
13
13
  SumXTimesYTooBig: "linear.regression.sum.x.times.y.too.big",
14
14
  ModelCreation: "linear.regression.model.creation",
15
- } as const;
15
+ };
16
16
 
17
17
  export class LinearRegression {
18
18
  private static readonly DEFAULT_ROUNDING: RoundingPort = new RoundToNearest();
@@ -2,7 +2,7 @@ import { RoundToDecimal } from "./rounding.adapter";
2
2
  import type { RoundingPort } from "./rounding.port";
3
3
  import { Sum } from "./sum.service";
4
4
 
5
- export const MeanError = { NotEnoughValues: "mean.not.enough.values" } as const;
5
+ export const MeanError = { NotEnoughValues: "mean.not.enough.values" };
6
6
 
7
7
  export class Mean {
8
8
  private static readonly DEFAULT_ROUNDING: RoundingPort = new RoundToDecimal(2);
package/src/mime.vo.ts CHANGED
@@ -2,7 +2,7 @@ import * as mime from "mime-types";
2
2
  import { Extension, type ExtensionType } from "./extension.vo";
3
3
  import { MimeValue } from "./mime-value.vo";
4
4
 
5
- export const MimeError = { NotAccepted: "mime.not.accepted" } as const;
5
+ export const MimeError = { NotAccepted: "mime.not.accepted" };
6
6
 
7
7
  export class Mime {
8
8
  private constructor(
@@ -30,7 +30,7 @@ export const MinMaxScalerError = {
30
30
  ValueOutOfRange: "min.max.scaler.value.out.of.range",
31
31
  ScaledOutOfBounds: "min.max.scaler.scaled.out.of.bounds",
32
32
  EmptyArray: "min.max.scaler.empty.array",
33
- } as const;
33
+ };
34
34
 
35
35
  export class MinMaxScaler {
36
36
  private static readonly DEFAULT_ROUNDING: RoundingPort = new RoundToDecimal(2);
package/src/money.vo.ts CHANGED
@@ -4,7 +4,7 @@ import type { MultiplicationFactorType } from "./multiplication-factor.vo";
4
4
  import { RoundDown, RoundToNearest } from "./rounding.adapter";
5
5
  import type { RoundingPort } from "./rounding.port";
6
6
 
7
- export const MoneyError = { SubtractResultLessThanZero: "money.subtract.result.less.than.zero" } as const;
7
+ export const MoneyError = { SubtractResultLessThanZero: "money.subtract.result.less.than.zero" };
8
8
 
9
9
  export class Money {
10
10
  private static readonly ZERO = MoneyAmount.parse(0);
@@ -4,7 +4,7 @@ export const MonthIsoIdError = {
4
4
  Type: "month.iso.id.type",
5
5
  BadChars: "month.iso.id.bad.chars",
6
6
  Invalid: "month.iso.id.invalid",
7
- } as const;
7
+ };
8
8
 
9
9
  // Four digits, hyphen, two digits
10
10
  const MONTH_ISO_ID_CHARS_WHITELIST = /^\d{4}-\d{2}$/;
@@ -3,7 +3,7 @@ import { z } from "zod/v4";
3
3
  export const MultiplicationFactorError = {
4
4
  Type: "multiplication.factor.type",
5
5
  Invalid: "multiplication.factor.invalid",
6
- } as const;
6
+ };
7
7
 
8
8
  export const MultiplicationFactor = z
9
9
  .number(MultiplicationFactorError.Type)
@@ -7,7 +7,7 @@ export const ObjectKeyError = {
7
7
  TooLong: "object.key.too.long",
8
8
  BadChars: "object.key.bad.chars",
9
9
  DotSegments: "object.key.dot.segments",
10
- } as const;
10
+ };
11
11
 
12
12
  // Lowercase letters, digits, dots, underscores, and hyphens
13
13
  const OBJECT_KEY_SEGMENT_CHARS_WHITELIST = /^[a-z0-9._-]+$/;
@@ -1,6 +1,6 @@
1
1
  import { ZScore } from "./z-score.service";
2
2
 
3
- export const OutlierDetectorError = { NotEnoughValues: "outlier.detector.not.enough.values" } as const;
3
+ export const OutlierDetectorError = { NotEnoughValues: "outlier.detector.not.enough.values" };
4
4
 
5
5
  export class OutlierDetector {
6
6
  private readonly zScore: ZScore;
@@ -3,7 +3,7 @@ import { z } from "zod/v4";
3
3
  export const PackageVersionSchemaError = {
4
4
  Type: "package.version.schema.error",
5
5
  BadChars: "package.version.schema.bad.chars",
6
- } as const;
6
+ };
7
7
 
8
8
  // v, 1-4 digits, dot, 1-4 digits, dot, 1-4 digits - () for capturing groups
9
9
  const PACKAGE_VERSIONS_CHARS_WHITELIST = /^v([0-9]{1,4})\.([0-9]{1,4})\.([0-9]{1,4})$/;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const PaginationPageError = { Type: "pagination.page.Type" } as const;
3
+ export const PaginationPageError = { Type: "pagination.page.Type" };
4
4
 
5
5
  export const Page = z.coerce
6
6
  .number(PaginationPageError.Type)
@@ -1,9 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const PaginationSkipError = {
4
- Type: "pagination.skip.type",
5
- Invalid: "pagination.skip.invalid",
6
- } as const;
3
+ export const PaginationSkipError = { Type: "pagination.skip.type", Invalid: "pagination.skip.invalid" };
7
4
 
8
5
  export const Skip = z
9
6
  .number(PaginationSkipError.Type)
@@ -1,9 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const PaginationTakeError = {
4
- Type: "pagination.take.type",
5
- Invalid: "pagination.take.invalid",
6
- } as const;
3
+ export const PaginationTakeError = { Type: "pagination.take.type", Invalid: "pagination.take.invalid" };
7
4
 
8
5
  export const Take = z
9
6
  .number(PaginationTakeError.Type)
@@ -1,7 +1,7 @@
1
1
  import { RoundToNearest } from "./rounding.adapter";
2
2
  import type { RoundingPort } from "./rounding.port";
3
3
 
4
- export const PercentageError = { InvalidDenominator: "percentage.invalid.denominator" } as const;
4
+ export const PercentageError = { InvalidDenominator: "percentage.invalid.denominator" };
5
5
 
6
6
  export class Percentage {
7
7
  static of(numerator: number, denominator: number, rounding: RoundingPort = new RoundToNearest()): number {
@@ -5,7 +5,7 @@ import { Sum } from "./sum.service";
5
5
 
6
6
  export const PopulationStandardDeviationError = {
7
7
  NotEnoughValues: "population.standard.deviation.not.enough.values",
8
- } as const;
8
+ };
9
9
 
10
10
  export class PopulationStandardDeviation {
11
11
  static calculate(values: number[], rounding: RoundingPort = new RoundToDecimal(2)): number {
@@ -3,7 +3,7 @@ import { z } from "zod/v4";
3
3
  export const QuarterIsoIdError = {
4
4
  Type: "quarter.iso.id.type",
5
5
  BadChars: "quarter.iso.id.bad.chars",
6
- } as const;
6
+ };
7
7
 
8
8
  export const QuarterIsoId = z
9
9
  .string(QuarterIsoIdError.Type)
@@ -2,7 +2,7 @@ import { RoundDown } from "./rounding.adapter";
2
2
 
3
3
  type RandomGenerateConfigType = { min: number; max: number };
4
4
 
5
- export const RandomError = { MinMax: "random.min.max" } as const;
5
+ export const RandomError = { MinMax: "random.min.max" };
6
6
 
7
7
  export class Random {
8
8
  private static readonly DEFAULT_MIN = 0;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const ReorderingItemPositionValueError = { Invalid: "reordering.position.type" } as const;
3
+ export const ReorderingItemPositionValueError = { Invalid: "reordering.position.type" };
4
4
 
5
5
  export const ReorderingItemPositionValue = z
6
6
  .number(ReorderingItemPositionValueError.Invalid)
@@ -11,7 +11,7 @@ export const ReorderingError = {
11
11
  CannotFindTarget: "reordering.cannot.find.target",
12
12
  };
13
13
 
14
- const ReorderingIdError = { Type: "reordering.id.type" } as const;
14
+ const ReorderingIdError = { Type: "reordering.id.type" };
15
15
 
16
16
  export const ReorderingId = z.string(ReorderingIdError.Type).min(1, ReorderingIdError.Type);
17
17
  export type ReorderingItemIdType = z.infer<typeof ReorderingId>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const RevisionValueError = { Type: "revision.value.type", Invalid: "revision.value.invalid" } as const;
3
+ export const RevisionValueError = { Type: "revision.value.type", Invalid: "revision.value.invalid" };
4
4
 
5
5
  export const RevisionValue = z
6
6
  .number(RevisionValueError.Type)
@@ -1,7 +1,7 @@
1
1
  import type { ETag, WeakETag } from "./etags.vo";
2
2
  import { RevisionValue, type RevisionValueType } from "./revision-value.vo";
3
3
 
4
- export const RevisionError = { Missing: "revision.missing", Mismatch: "revision.mismatch" } as const;
4
+ export const RevisionError = { Missing: "revision.missing", Mismatch: "revision.mismatch" };
5
5
 
6
6
  export class Revision {
7
7
  static readonly INITIAL: RevisionValueType = RevisionValue.parse(0);
@@ -19,10 +19,7 @@ export class RoundDown implements RoundingPort {
19
19
  }
20
20
  }
21
21
 
22
- export const RoundingDecimalError = {
23
- Type: "rounding.decimal.type",
24
- Invalid: "rounding.decimal.invalid",
25
- } as const;
22
+ export const RoundingDecimalError = { Type: "rounding.decimal.type", Invalid: "rounding.decimal.invalid" };
26
23
 
27
24
  export const RoundingDecimal = z
28
25
  .number(RoundingDecimalError.Type)
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- export const SizeBytesError = { Invalid: "size.bytes.invalid" } as const;
3
+ export const SizeBytesError = { Invalid: "size.bytes.invalid" };
4
4
 
5
5
  export const SizeBytes = z
6
6
  .number(SizeBytesError.Invalid)
@@ -1,7 +1,7 @@
1
1
  import type { Duration } from "./duration.service";
2
2
  import { Timestamp } from "./timestamp.vo";
3
3
 
4
- export const StopwatchError = { AlreadyStopped: "stopwatch.already.stopped" } as const;
4
+ export const StopwatchError = { AlreadyStopped: "stopwatch.already.stopped" };
5
5
 
6
6
  enum StopwatchState {
7
7
  started = "started",