@bgord/tools 1.2.13 → 1.2.15
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/age-years.vo.js +2 -0
- package/dist/api-key.vo.js +2 -0
- package/dist/basename.vo.js +2 -0
- package/dist/day-iso-id.vo.js +2 -0
- package/dist/directory-path-absolute.vo.js +2 -0
- package/dist/directory-path-relative.vo.js +3 -1
- package/dist/distance-value.vo.js +2 -0
- package/dist/division-factor.vo.js +2 -0
- package/dist/dll.service.js +2 -6
- package/dist/duration-ms.vo.js +1 -0
- package/dist/email.vo.js +1 -0
- package/dist/etags.vo.js +0 -2
- package/dist/extension.vo.js +2 -0
- package/dist/file-path-absolute-schema.vo.js +2 -0
- package/dist/file-path-relative-schema.vo.js +2 -0
- package/dist/filename-affix.vo.js +2 -0
- package/dist/height-milimiters.vo.js +2 -0
- package/dist/hour-schema.vo.js +3 -1
- package/dist/iban-schema.vo.js +2 -0
- package/dist/image.vo.js +4 -0
- package/dist/integer-non-negative.vo.js +2 -0
- package/dist/integer-positive.vo.js +2 -0
- package/dist/integer.vo.js +1 -0
- package/dist/linear-regression.service.js +2 -0
- package/dist/mime-value.vo.js +2 -0
- package/dist/min-max-scaler.service.js +1 -1
- package/dist/minute-schema.vo.js +2 -0
- package/dist/minute.vo.d.ts +1 -1
- package/dist/minute.vo.js +3 -3
- package/dist/money-amount.vo.js +2 -0
- package/dist/month-iso-id.vo.js +2 -0
- package/dist/multiplication-factor.vo.js +2 -0
- package/dist/object-key.vo.js +2 -0
- package/dist/package-version-schema.vo.js +2 -0
- package/dist/package-version.vo.js +1 -5
- package/dist/pagination-page.vo.js +1 -1
- package/dist/percentage.service.js +0 -2
- package/dist/quarter-iso-id.vo.js +2 -0
- package/dist/random.service.js +1 -3
- package/dist/reordering.service.js +2 -0
- package/dist/rounding-decimal.strategy.js +2 -0
- package/dist/size-bytes.vo.js +2 -0
- package/dist/time-zone-offset-value.vo.js +6 -4
- package/dist/timestamp-value.vo.js +2 -0
- package/dist/timezone.vo.js +2 -0
- package/dist/url-with-slash.vo.js +3 -1
- package/dist/url-without-slash.vo.js +3 -1
- package/dist/week-iso-id.vo.js +2 -0
- package/dist/weekday.vo.d.ts +3 -1
- package/dist/weekday.vo.js +4 -3
- package/dist/weight-grams.vo.js +2 -0
- package/dist/weight.vo.d.ts +0 -2
- package/dist/weight.vo.js +1 -7
- package/dist/year-iso-id.vo.js +2 -0
- package/dist/year.vo.js +5 -1
- package/package.json +8 -7
- package/src/age-years.vo.ts +2 -0
- package/src/api-key.vo.ts +2 -0
- package/src/basename.vo.ts +2 -0
- package/src/day-iso-id.vo.ts +2 -0
- package/src/directory-path-absolute.vo.ts +2 -0
- package/src/directory-path-relative.vo.ts +3 -1
- package/src/distance-value.vo.ts +2 -0
- package/src/division-factor.vo.ts +2 -0
- package/src/dll.service.ts +4 -8
- package/src/duration-ms.vo.ts +2 -0
- package/src/email.vo.ts +2 -0
- package/src/etags.vo.ts +0 -2
- package/src/extension.vo.ts +2 -0
- package/src/file-path-absolute-schema.vo.ts +2 -0
- package/src/file-path-relative-schema.vo.ts +2 -0
- package/src/filename-affix.vo.ts +2 -0
- package/src/height-milimiters.vo.ts +2 -0
- package/src/hour-schema.vo.ts +3 -1
- package/src/iban-schema.vo.ts +2 -0
- package/src/image.vo.ts +4 -0
- package/src/integer-non-negative.vo.ts +2 -0
- package/src/integer-positive.vo.ts +2 -0
- package/src/integer.vo.ts +2 -0
- package/src/linear-regression.service.ts +2 -0
- package/src/mime-value.vo.ts +2 -0
- package/src/min-max-scaler.service.ts +1 -1
- package/src/minute-schema.vo.ts +2 -0
- package/src/minute.vo.ts +4 -4
- package/src/money-amount.vo.ts +2 -0
- package/src/month-iso-id.vo.ts +2 -0
- package/src/multiplication-factor.vo.ts +2 -0
- package/src/object-key.vo.ts +2 -0
- package/src/package-version-schema.vo.ts +2 -0
- package/src/package-version.vo.ts +1 -4
- package/src/pagination-page.vo.ts +1 -1
- package/src/percentage.service.ts +0 -1
- package/src/quarter-iso-id.vo.ts +2 -0
- package/src/random.service.ts +1 -2
- package/src/reordering.service.ts +2 -0
- package/src/rounding-decimal.strategy.ts +2 -0
- package/src/size-bytes.vo.ts +2 -0
- package/src/time-zone-offset-value.vo.ts +6 -4
- package/src/timestamp-value.vo.ts +2 -0
- package/src/timezone.vo.ts +2 -0
- package/src/url-with-slash.vo.ts +3 -1
- package/src/url-without-slash.vo.ts +3 -1
- package/src/week-iso-id.vo.ts +2 -0
- package/src/weekday.vo.ts +4 -2
- package/src/weight-grams.vo.ts +2 -0
- package/src/weight.vo.ts +1 -9
- package/src/year-iso-id.vo.ts +2 -0
- package/src/year.vo.ts +3 -1
package/dist/age-years.vo.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const AgeYearsError = { Type: "age.years.type", Invalid: "age.years.invalid" };
|
|
3
3
|
export const AgeYearsConstraints = { min: 1, max: 130 };
|
|
4
|
+
// Stryker disable all
|
|
4
5
|
export const AgeYears = z
|
|
6
|
+
// Stryker restore all
|
|
5
7
|
.number(AgeYearsError.Type)
|
|
6
8
|
.int(AgeYearsError.Type)
|
|
7
9
|
.min(1, AgeYearsError.Invalid)
|
package/dist/api-key.vo.js
CHANGED
|
@@ -2,7 +2,9 @@ import { z } from "zod/v4";
|
|
|
2
2
|
export const ApiKeyError = { Type: "api.key.type", Length: "api.key.length", 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
|
|
5
6
|
export const ApiKey = z
|
|
7
|
+
// Stryker disable all
|
|
6
8
|
.string(ApiKeyError.Type)
|
|
7
9
|
.length(64, ApiKeyError.Length)
|
|
8
10
|
.regex(API_KEY_CHARS, ApiKeyError.BadChars)
|
package/dist/basename.vo.js
CHANGED
|
@@ -11,7 +11,9 @@ 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
|
|
14
15
|
export const Basename = z
|
|
16
|
+
// Stryker restore all
|
|
15
17
|
.string(BasenameError.Type)
|
|
16
18
|
.min(1, BasenameError.Empty)
|
|
17
19
|
.max(128, BasenameError.TooLong)
|
package/dist/day-iso-id.vo.js
CHANGED
|
@@ -7,7 +7,9 @@ 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
|
|
10
11
|
export const DayIsoId = z
|
|
12
|
+
// Stryker restore all
|
|
11
13
|
.string(DayIsoIdError.Type)
|
|
12
14
|
.regex(DAY_ISO_ID_CHARS, DayIsoIdError.BadChars)
|
|
13
15
|
.refine((value) => isValid(parseISO(value)), DayIsoIdError.InvalidDate)
|
|
@@ -10,7 +10,9 @@ 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
|
|
13
14
|
export const DirectoryPathAbsoluteSchema = z
|
|
15
|
+
// Stryker restore all
|
|
14
16
|
.string(DirectoryPathAbsoluteError.Type)
|
|
15
17
|
.min(1, DirectoryPathAbsoluteError.Empty)
|
|
16
18
|
.max(512, DirectoryPathAbsoluteError.TooLong)
|
|
@@ -5,12 +5,14 @@ export const DirectoryPathRelativeError = {
|
|
|
5
5
|
LeadingSlash: "directory.path.relative.leading.slash",
|
|
6
6
|
TooLong: "directory.path.absolue.too.long",
|
|
7
7
|
TrailingSlash: "directory.path.absolue.trailing.slash",
|
|
8
|
-
Type: "directory.path.relative.
|
|
8
|
+
Type: "directory.path.relative.type",
|
|
9
9
|
};
|
|
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
|
|
13
14
|
export const DirectoryPathRelativeSchema = z
|
|
15
|
+
// Stryker restore all
|
|
14
16
|
.string(DirectoryPathRelativeError.Type)
|
|
15
17
|
.min(1, DirectoryPathRelativeError.Empty)
|
|
16
18
|
.max(512, DirectoryPathRelativeError.TooLong)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const DistanceValueError = { Type: "distance.value.type", Invalid: "distance.value.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const DistanceValue = z
|
|
5
|
+
// Stryker restore all
|
|
4
6
|
.number(DistanceValueError.Type)
|
|
5
7
|
.int(DistanceValueError.Type)
|
|
6
8
|
.min(0, DistanceValueError.Invalid)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const DivisionFactorError = { Type: "division.factor.type", Invalid: "division.factor.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const DivisionFactor = z
|
|
5
|
+
// Stryker restore all
|
|
4
6
|
.number(DivisionFactorError.Type)
|
|
5
7
|
.gt(0, DivisionFactorError.Invalid)
|
|
6
8
|
.brand("DivisionFactor");
|
package/dist/dll.service.js
CHANGED
|
@@ -96,9 +96,7 @@ export class DoublyLinkedList {
|
|
|
96
96
|
this.size += 1;
|
|
97
97
|
node.prev = target;
|
|
98
98
|
node.next = nextNode;
|
|
99
|
-
|
|
100
|
-
nextNode.prev = node;
|
|
101
|
-
}
|
|
99
|
+
nextNode.prev = node;
|
|
102
100
|
target.next = node;
|
|
103
101
|
}
|
|
104
102
|
insertBefore(node, target) {
|
|
@@ -110,9 +108,7 @@ export class DoublyLinkedList {
|
|
|
110
108
|
this.size += 1;
|
|
111
109
|
node.next = target;
|
|
112
110
|
node.prev = prevNode;
|
|
113
|
-
|
|
114
|
-
prevNode.next = node;
|
|
115
|
-
}
|
|
111
|
+
prevNode.next = node;
|
|
116
112
|
target.prev = node;
|
|
117
113
|
}
|
|
118
114
|
find(callback) {
|
package/dist/duration-ms.vo.js
CHANGED
package/dist/email.vo.js
CHANGED
package/dist/etags.vo.js
CHANGED
package/dist/extension.vo.js
CHANGED
|
@@ -8,7 +8,9 @@ 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
|
|
11
12
|
export const Extension = z
|
|
13
|
+
// Stryker restore all
|
|
12
14
|
.string(ExtensionError.Type)
|
|
13
15
|
.toLowerCase()
|
|
14
16
|
.min(2, ExtensionError.Empty)
|
|
@@ -8,7 +8,9 @@ export const FilePathAbsoluteSchemaError = {
|
|
|
8
8
|
BackslashForbidden: "file.path.absolute.backslash.forbidden",
|
|
9
9
|
Empty: "file.path.absolute.empty",
|
|
10
10
|
};
|
|
11
|
+
// Stryker disable all
|
|
11
12
|
export const FilePathAbsoluteSchema = z
|
|
13
|
+
// Stryker restore all
|
|
12
14
|
.string(FilePathAbsoluteSchemaError.Type)
|
|
13
15
|
.min(1, FilePathAbsoluteSchemaError.Empty)
|
|
14
16
|
.refine((value) => value.startsWith("/"), FilePathAbsoluteSchemaError.LeadingSlash)
|
|
@@ -8,7 +8,9 @@ export const FilePathRelativeSchemaError = {
|
|
|
8
8
|
RequiresDirectory: "file.path.relative.requires.directory",
|
|
9
9
|
Empty: "file.path.relative.empty",
|
|
10
10
|
};
|
|
11
|
+
// Stryker disable all
|
|
11
12
|
export const FilePathRelativeSchema = z
|
|
13
|
+
// Stryker restore all
|
|
12
14
|
.string(FilePathRelativeSchemaError.Type)
|
|
13
15
|
.min(1, FilePathRelativeSchemaError.Empty)
|
|
14
16
|
.refine((value) => !value.startsWith("/"), FilePathRelativeSchemaError.LeadingSlash)
|
|
@@ -12,7 +12,9 @@ export const FilenameAffixError = {
|
|
|
12
12
|
};
|
|
13
13
|
// Letters, digits, underscores, and hyphens allowed
|
|
14
14
|
const FILENAME_AFFIX_WHITELIST = /^[a-zA-Z0-9_-]+$/;
|
|
15
|
+
// Stryker disable all
|
|
15
16
|
export const FilenameAffix = z
|
|
17
|
+
// Stryker restore all
|
|
16
18
|
.string(FilenameAffixError.Type)
|
|
17
19
|
.min(1, FilenameAffixError.Empty)
|
|
18
20
|
.max(32, FilenameAffixError.TooLong)
|
|
@@ -3,7 +3,9 @@ export const HeightMillimetersError = {
|
|
|
3
3
|
Type: "height.millimeters.type",
|
|
4
4
|
Invalid: "height.millimeters.invalid",
|
|
5
5
|
};
|
|
6
|
+
// Stryker disable all
|
|
6
7
|
export const HeightMillimeters = z
|
|
8
|
+
// Stryker restore all
|
|
7
9
|
.number(HeightMillimetersError.Type)
|
|
8
10
|
.int(HeightMillimetersError.Type)
|
|
9
11
|
.min(0, HeightMillimetersError.Invalid)
|
package/dist/hour-schema.vo.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
export const HourSchemaError = { Type: "hour.schema.
|
|
2
|
+
export const HourSchemaError = { Type: "hour.schema.type", Invalid: "hour.schema.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const HourSchema = z
|
|
5
|
+
// Stryker restore all
|
|
4
6
|
.number(HourSchemaError.Type)
|
|
5
7
|
.int(HourSchemaError.Type)
|
|
6
8
|
.gte(0, HourSchemaError.Invalid)
|
package/dist/iban-schema.vo.js
CHANGED
|
@@ -2,7 +2,9 @@ import { z } from "zod/v4";
|
|
|
2
2
|
export const IbanSchemaError = { Type: "iban.schema.type", Invalid: "iban.schema.invalid" };
|
|
3
3
|
// Two letters for country code, two digits, 11–30 uppercase letters or digits
|
|
4
4
|
const IBAN_CHARS_WHITELIST = /^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/;
|
|
5
|
+
// Stryker disable all
|
|
5
6
|
export const IbanSchema = z
|
|
7
|
+
// Stryker restore all
|
|
6
8
|
.string(IbanSchemaError.Type)
|
|
7
9
|
.toUpperCase()
|
|
8
10
|
.transform((value) => value.replaceAll(" ", ""))
|
package/dist/image.vo.js
CHANGED
|
@@ -2,13 +2,17 @@ import { z } from "zod/v4";
|
|
|
2
2
|
export const ImageWidthError = { Type: "image.width.type", Length: "image.width.length" };
|
|
3
3
|
export const ImageHeightError = { Type: "image.height.type", Length: "image.height.length" };
|
|
4
4
|
const IMAGE_DIMENSIONS_CONSTRAINTS = { min: 1, max: 10_000 };
|
|
5
|
+
// Stryker disable all
|
|
5
6
|
export const ImageWidth = z
|
|
7
|
+
// Stryker restore all
|
|
6
8
|
.number(ImageWidthError.Type)
|
|
7
9
|
.int(ImageWidthError.Type)
|
|
8
10
|
.min(IMAGE_DIMENSIONS_CONSTRAINTS.min, ImageWidthError.Length)
|
|
9
11
|
.max(IMAGE_DIMENSIONS_CONSTRAINTS.max, ImageWidthError.Length)
|
|
10
12
|
.brand("ImageWidth");
|
|
13
|
+
// Stryker disable all
|
|
11
14
|
export const ImageHeight = z
|
|
15
|
+
// Stryker restore all
|
|
12
16
|
.number(ImageHeightError.Type)
|
|
13
17
|
.int(ImageHeightError.Type)
|
|
14
18
|
.min(IMAGE_DIMENSIONS_CONSTRAINTS.min, ImageHeightError.Length)
|
|
@@ -3,7 +3,9 @@ export const IntegerNonNegativeError = {
|
|
|
3
3
|
Type: "integer.non.negative.type",
|
|
4
4
|
Invalid: "integer.non.negative.invalid",
|
|
5
5
|
};
|
|
6
|
+
// Stryker disable all
|
|
6
7
|
export const IntegerNonNegative = z
|
|
8
|
+
// Stryker restore all
|
|
7
9
|
.number(IntegerNonNegativeError.Type)
|
|
8
10
|
.int(IntegerNonNegativeError.Type)
|
|
9
11
|
.min(0, IntegerNonNegativeError.Invalid)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const IntegerPositiveError = { Type: "integer.positive.type", Invalid: "integer.positive.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const IntegerPositive = z
|
|
5
|
+
// Stryker restore all
|
|
4
6
|
.number(IntegerPositiveError.Type)
|
|
5
7
|
.int(IntegerPositiveError.Type)
|
|
6
8
|
.min(1, IntegerPositiveError.Invalid)
|
package/dist/integer.vo.js
CHANGED
|
@@ -34,10 +34,12 @@ export class LinearRegression {
|
|
|
34
34
|
throw new Error(LinearRegressionError.SumXTooBig);
|
|
35
35
|
if (Math.abs(sumY) >= Number.MAX_SAFE_INTEGER)
|
|
36
36
|
throw new Error(LinearRegressionError.SumYTooBig);
|
|
37
|
+
// Stryker disable all
|
|
37
38
|
if (Math.abs(sumXY) >= Number.MAX_SAFE_INTEGER)
|
|
38
39
|
throw new Error(LinearRegressionError.SumXTimesYTooBig);
|
|
39
40
|
if (Math.abs(sumXX) >= Number.MAX_SAFE_INTEGER)
|
|
40
41
|
throw new Error(LinearRegressionError.SumXSquaredTooBig);
|
|
42
|
+
// Stryker restore all
|
|
41
43
|
const bDenominator = sumXX - sumX ** 2 / count;
|
|
42
44
|
if (bDenominator === 0)
|
|
43
45
|
throw new Error(LinearRegressionError.ModelCreation);
|
package/dist/mime-value.vo.js
CHANGED
|
@@ -2,7 +2,9 @@ import { z } from "zod/v4";
|
|
|
2
2
|
export const MimeValueError = { Type: "mime.value.type", Invalid: "mime.value.invalid" };
|
|
3
3
|
// One to twenty four lowercase letters, asterisk or hyphen, forward slash, one to twenty four lowercase letters, asterisk or hyphen
|
|
4
4
|
const MIME_VALUE_CHARS_WHITELIST = /^[a-z*-]{1,24}\/[a-z*-]{1,24}$/;
|
|
5
|
+
// Stryker disable all
|
|
5
6
|
export const MimeValue = z
|
|
7
|
+
// Stryker restore all
|
|
6
8
|
.string(MimeValueError.Type)
|
|
7
9
|
.regex(MIME_VALUE_CHARS_WHITELIST, MimeValueError.Invalid)
|
|
8
10
|
.transform((value) => ({ type: value.split("/")[0], subtype: value.split("/")[1] }))
|
|
@@ -31,7 +31,7 @@ export class MinMaxScaler {
|
|
|
31
31
|
if (value < min || value > max)
|
|
32
32
|
throw new Error(MinMaxScalerError.ValueOutOfRange);
|
|
33
33
|
if (min === max) {
|
|
34
|
-
return { original: value, scaled: (lower + upper) / 2, isMin:
|
|
34
|
+
return { original: value, scaled: (lower + upper) / 2, isMin: true, isMax: true };
|
|
35
35
|
}
|
|
36
36
|
const result = ((value - min) / (max - min)) * (upper - lower) + lower;
|
|
37
37
|
return {
|
package/dist/minute-schema.vo.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const MinuteSchemaError = { Type: "minute.schema.error", Invalid: "minute.schema.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const MinuteSchema = z
|
|
5
|
+
// Stryker restore all
|
|
4
6
|
.number(MinuteSchemaError.Type)
|
|
5
7
|
.int(MinuteSchemaError.Type)
|
|
6
8
|
.gte(0, MinuteSchemaError.Invalid)
|
package/dist/minute.vo.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ export declare class Minute {
|
|
|
12
12
|
static max(): Minute;
|
|
13
13
|
get(): MinuteSchemaType;
|
|
14
14
|
equals(another: Minute): boolean;
|
|
15
|
-
isAfter(another: Minute): boolean;
|
|
16
15
|
isBefore(another: Minute): boolean;
|
|
16
|
+
isAfter(another: Minute): boolean;
|
|
17
17
|
static list(): readonly Minute[];
|
|
18
18
|
toString(): string;
|
|
19
19
|
toJSON(): number;
|
package/dist/minute.vo.js
CHANGED
|
@@ -29,12 +29,12 @@ export class Minute {
|
|
|
29
29
|
equals(another) {
|
|
30
30
|
return this.value === another.value;
|
|
31
31
|
}
|
|
32
|
-
isAfter(another) {
|
|
33
|
-
return this.value > another.value;
|
|
34
|
-
}
|
|
35
32
|
isBefore(another) {
|
|
36
33
|
return this.value < another.value;
|
|
37
34
|
}
|
|
35
|
+
isAfter(another) {
|
|
36
|
+
return this.value > another.value;
|
|
37
|
+
}
|
|
38
38
|
static list() {
|
|
39
39
|
return Array.from({ length: 60 }, (_, index) => Minute.fromValue(index));
|
|
40
40
|
}
|
package/dist/money-amount.vo.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const MoneyAmountError = { Type: "money.amount.type", Invalid: "money.amount.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const MoneyAmount = z
|
|
5
|
+
// Stryker restore all
|
|
4
6
|
.number(MoneyAmountError.Type)
|
|
5
7
|
.int(MoneyAmountError.Type)
|
|
6
8
|
.min(0, MoneyAmountError.Invalid)
|
package/dist/month-iso-id.vo.js
CHANGED
|
@@ -6,7 +6,9 @@ export const MonthIsoIdError = {
|
|
|
6
6
|
};
|
|
7
7
|
// Four digits, hyphen, two digits
|
|
8
8
|
const MONTH_ISO_ID_CHARS_WHITELIST = /^\d{4}-\d{2}$/;
|
|
9
|
+
// Stryker disable all
|
|
9
10
|
export const MonthIsoId = z
|
|
11
|
+
// Stryker restore all
|
|
10
12
|
.string(MonthIsoIdError.Type)
|
|
11
13
|
.regex(MONTH_ISO_ID_CHARS_WHITELIST, MonthIsoIdError.BadChars)
|
|
12
14
|
.refine((value) => {
|
|
@@ -3,7 +3,9 @@ export const MultiplicationFactorError = {
|
|
|
3
3
|
Type: "multiplication.factor.type",
|
|
4
4
|
Invalid: "multiplication.factor.invalid",
|
|
5
5
|
};
|
|
6
|
+
// Stryker disable all
|
|
6
7
|
export const MultiplicationFactor = z
|
|
8
|
+
// Stryker restore all
|
|
7
9
|
.number(MultiplicationFactorError.Type)
|
|
8
10
|
.min(0, MultiplicationFactorError.Invalid)
|
|
9
11
|
.brand("MultiplicationFactor");
|
package/dist/object-key.vo.js
CHANGED
|
@@ -10,7 +10,9 @@ export const ObjectKeyError = {
|
|
|
10
10
|
// Lowercase letters, digits, dots, underscores, and hyphens
|
|
11
11
|
const OBJECT_KEY_SEGMENT_CHARS_WHITELIST = /^[a-z0-9._-]+$/;
|
|
12
12
|
const DOT_SEGMENTS = [".", ".."];
|
|
13
|
+
// Stryker disable all
|
|
13
14
|
export const ObjectKey = z
|
|
15
|
+
// Stryker restore all
|
|
14
16
|
.string(ObjectKeyError.Type)
|
|
15
17
|
.min(1, ObjectKeyError.Empty)
|
|
16
18
|
.max(256, ObjectKeyError.TooLong)
|
|
@@ -5,7 +5,9 @@ export const PackageVersionSchemaError = {
|
|
|
5
5
|
};
|
|
6
6
|
// v, 1-4 digits, dot, 1-4 digits, dot, 1-4 digits - () for capturing groups
|
|
7
7
|
const PACKAGE_VERSIONS_CHARS_WHITELIST = /^v([0-9]{1,4})\.([0-9]{1,4})\.([0-9]{1,4})$/;
|
|
8
|
+
// Stryker disable all
|
|
8
9
|
export const PackageVersionSchema = z
|
|
10
|
+
// Stryker restore all
|
|
9
11
|
.string(PackageVersionSchemaError.Type)
|
|
10
12
|
.regex(PACKAGE_VERSIONS_CHARS_WHITELIST, PackageVersionSchemaError.BadChars)
|
|
11
13
|
.transform((value) => {
|
|
@@ -28,11 +28,7 @@ export class PackageVersion {
|
|
|
28
28
|
return true;
|
|
29
29
|
if (this.minor < another.minor)
|
|
30
30
|
return false;
|
|
31
|
-
|
|
32
|
-
return true;
|
|
33
|
-
if (this.patch < another.patch)
|
|
34
|
-
return false;
|
|
35
|
-
return true;
|
|
31
|
+
return this.patch >= another.patch;
|
|
36
32
|
}
|
|
37
33
|
toString() {
|
|
38
34
|
return `${this.major}.${this.minor}.${this.patch}`;
|
|
@@ -4,8 +4,6 @@ export class Percentage {
|
|
|
4
4
|
static of(numerator, denominator, rounding = new RoundingToNearestStrategy()) {
|
|
5
5
|
if (denominator === 0)
|
|
6
6
|
throw new Error(PercentageError.InvalidDenominator);
|
|
7
|
-
if (numerator === 0)
|
|
8
|
-
return 0;
|
|
9
7
|
return rounding.round((numerator / denominator) * 100);
|
|
10
8
|
}
|
|
11
9
|
}
|
|
@@ -3,7 +3,9 @@ export const QuarterIsoIdError = {
|
|
|
3
3
|
Type: "quarter.iso.id.type",
|
|
4
4
|
BadChars: "quarter.iso.id.bad.chars",
|
|
5
5
|
};
|
|
6
|
+
// Stryker disable all
|
|
6
7
|
export const QuarterIsoId = z
|
|
8
|
+
// Stryker restore all
|
|
7
9
|
.string(QuarterIsoIdError.Type)
|
|
8
10
|
.regex(/^\d{4}-Q[1-4]$/, QuarterIsoIdError.BadChars)
|
|
9
11
|
.brand("QuarterIsoId");
|
package/dist/random.service.js
CHANGED
|
@@ -6,9 +6,7 @@ export class Random {
|
|
|
6
6
|
static generate(config) {
|
|
7
7
|
const min = config ? config.min : Random.DEFAULT_MIN;
|
|
8
8
|
const max = config ? config.max : Random.DEFAULT_MAX;
|
|
9
|
-
if (min
|
|
10
|
-
throw new Error(RandomError.MinMax);
|
|
11
|
-
if (min > max)
|
|
9
|
+
if (min >= max)
|
|
12
10
|
throw new Error(RandomError.MinMax);
|
|
13
11
|
return new RoundingDownStrategy().round(Math.random() * (max - min + 1)) + min;
|
|
14
12
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Stryker disable all
|
|
1
2
|
import { z } from "zod/v4";
|
|
2
3
|
import { DoublyLinkedList, Node } from "./dll.service";
|
|
3
4
|
import { ReorderingItemPositionValue, } from "./reordering-item-position-value.vo";
|
|
@@ -131,3 +132,4 @@ export class ReorderingIntegrator {
|
|
|
131
132
|
return (a, b) => a.position - b.position;
|
|
132
133
|
}
|
|
133
134
|
}
|
|
135
|
+
// Stryker restore all
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const RoundingDecimalError = { Type: "rounding.decimal.type", Invalid: "rounding.decimal.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const RoundingDecimal = z
|
|
5
|
+
// Stryker restore all
|
|
4
6
|
.number(RoundingDecimalError.Type)
|
|
5
7
|
.int(RoundingDecimalError.Invalid)
|
|
6
8
|
.min(1, RoundingDecimalError.Invalid)
|
package/dist/size-bytes.vo.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const SizeBytesError = { Invalid: "size.bytes.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const SizeBytes = z
|
|
5
|
+
// Stryker restore all
|
|
4
6
|
.number(SizeBytesError.Invalid)
|
|
5
7
|
.int(SizeBytesError.Invalid)
|
|
6
8
|
.gte(0, SizeBytesError.Invalid)
|
|
@@ -4,12 +4,14 @@ export const TimeZoneOffsetValueError = {
|
|
|
4
4
|
Min: "time.zone.offset.value.min",
|
|
5
5
|
Max: "time.zone.offset.value.max",
|
|
6
6
|
};
|
|
7
|
+
// Stryker disable all
|
|
7
8
|
export const TimeZoneOffsetValue = z.coerce
|
|
8
|
-
|
|
9
|
-
.
|
|
9
|
+
// Stryker restore all
|
|
10
|
+
.number(TimeZoneOffsetValueError.Type)
|
|
11
|
+
.int(TimeZoneOffsetValueError.Type)
|
|
10
12
|
// UTC+14 (Kiribati)
|
|
11
|
-
.min(-840,
|
|
13
|
+
.min(-840, TimeZoneOffsetValueError.Min)
|
|
12
14
|
// UTC-12 (Baker Island)
|
|
13
|
-
.max(720,
|
|
15
|
+
.max(720, TimeZoneOffsetValueError.Max)
|
|
14
16
|
.default(0) // Default to UTC if missing or invalid
|
|
15
17
|
.brand("TimeZoneOffsetValue");
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const TimestampValueError = { Invalid: "timestamp.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const TimestampValue = z
|
|
5
|
+
// Stryker restore all
|
|
4
6
|
.number(TimestampValueError.Invalid)
|
|
5
7
|
.int(TimestampValueError.Invalid)
|
|
6
8
|
.gte(0, TimestampValueError.Invalid)
|
package/dist/timezone.vo.js
CHANGED
|
@@ -5,7 +5,9 @@ export const TimezoneError = {
|
|
|
5
5
|
TooLong: "timezone.too.long",
|
|
6
6
|
Invalid: "timezone.invalid",
|
|
7
7
|
};
|
|
8
|
+
// Stryker disable all
|
|
8
9
|
export const Timezone = z
|
|
10
|
+
// Stryker restore all
|
|
9
11
|
.string(TimezoneError.Type)
|
|
10
12
|
.min(1, TimezoneError.Empty)
|
|
11
13
|
.max(128, TimezoneError.TooLong)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const UrlWithSlashError = { Invalid: "url.with.slash.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const UrlWithSlash = z
|
|
4
|
-
|
|
5
|
+
// Stryker disable all
|
|
6
|
+
.url(UrlWithSlashError.Invalid)
|
|
5
7
|
.refine((value) => value.endsWith("/"), UrlWithSlashError.Invalid)
|
|
6
8
|
.brand("UrlWithSlash");
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const UrlWithoutSlashError = { Invalid: "url.without.slash.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const UrlWithoutSlash = z
|
|
4
|
-
|
|
5
|
+
// Stryker restore all
|
|
6
|
+
.url(UrlWithoutSlashError.Invalid)
|
|
5
7
|
.refine((value) => !value.endsWith("/"), UrlWithoutSlashError.Invalid)
|
|
6
8
|
.brand("UrlWithoutSlash");
|
package/dist/week-iso-id.vo.js
CHANGED
|
@@ -7,7 +7,9 @@ export const WeekIsoIdError = {
|
|
|
7
7
|
};
|
|
8
8
|
// Four digits, hypen, W, followed by two digits
|
|
9
9
|
const WEEK_ISO_ID_CHARS_WHITELIST = /^[0-9]{4}-W[0-9]{2}$/;
|
|
10
|
+
// Stryker disable all
|
|
10
11
|
export const WeekIsoId = z
|
|
12
|
+
// Stryker restore all
|
|
11
13
|
.string(WeekIsoIdError.Type)
|
|
12
14
|
.regex(WEEK_ISO_ID_CHARS_WHITELIST, WeekIsoIdError.BadChars)
|
|
13
15
|
.refine((value) => {
|
package/dist/weekday.vo.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ export declare enum WeekdayFormatterEnum {
|
|
|
7
7
|
ISO_NUMBER = "ISO_NUMBER",// Monday=1 ... Sunday=7
|
|
8
8
|
ZERO_BASED_NUMBER = "ZERO_BASED_NUMBER"
|
|
9
9
|
}
|
|
10
|
-
export declare const WeekdayValueError:
|
|
10
|
+
export declare const WeekdayValueError: {
|
|
11
|
+
readonly Invalid: "weekday.invalid";
|
|
12
|
+
};
|
|
11
13
|
export declare const WeekdayFormatters: Record<WeekdayFormatterEnum, WeekdayFormatter>;
|
|
12
14
|
export declare class Weekday {
|
|
13
15
|
private readonly value;
|
package/dist/weekday.vo.js
CHANGED
|
@@ -6,7 +6,7 @@ export var WeekdayFormatterEnum;
|
|
|
6
6
|
WeekdayFormatterEnum["ISO_NUMBER"] = "ISO_NUMBER";
|
|
7
7
|
WeekdayFormatterEnum["ZERO_BASED_NUMBER"] = "ZERO_BASED_NUMBER";
|
|
8
8
|
})(WeekdayFormatterEnum || (WeekdayFormatterEnum = {}));
|
|
9
|
-
export const WeekdayValueError = "invalid
|
|
9
|
+
export const WeekdayValueError = { Invalid: "weekday.invalid" };
|
|
10
10
|
const FULL_NAMES = [
|
|
11
11
|
"Sunday",
|
|
12
12
|
"Monday",
|
|
@@ -36,8 +36,9 @@ export class Weekday {
|
|
|
36
36
|
static FRIDAY = new Weekday(5);
|
|
37
37
|
static SATURDAY = new Weekday(6);
|
|
38
38
|
constructor(candidate, formatter) {
|
|
39
|
-
if (!Number.isInteger(candidate) || candidate < 0 || candidate > 6)
|
|
40
|
-
throw new Error(WeekdayValueError);
|
|
39
|
+
if (!Number.isInteger(candidate) || candidate < 0 || candidate > 6) {
|
|
40
|
+
throw new Error(WeekdayValueError.Invalid);
|
|
41
|
+
}
|
|
41
42
|
this.value = candidate;
|
|
42
43
|
this.formatter = formatter ?? WeekdayFormatters.FULL;
|
|
43
44
|
}
|
package/dist/weight-grams.vo.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export const WeightGramsError = { Type: "weight.grams.type", Invalid: "weight.grams.invalid" };
|
|
3
|
+
// Stryker disable all
|
|
3
4
|
export const WeightGrams = z
|
|
5
|
+
// Stryker restore all
|
|
4
6
|
.number(WeightGramsError.Type)
|
|
5
7
|
.int(WeightGramsError.Type)
|
|
6
8
|
.gte(0, WeightGramsError.Invalid)
|
package/dist/weight.vo.d.ts
CHANGED
|
@@ -18,9 +18,7 @@ export declare class Weight {
|
|
|
18
18
|
divide(divisor: DivisionFactorType): Weight;
|
|
19
19
|
equals(other: Weight): boolean;
|
|
20
20
|
greaterThan(other: Weight): boolean;
|
|
21
|
-
greaterThanOrEqual(other: Weight): boolean;
|
|
22
21
|
lessThan(other: Weight): boolean;
|
|
23
|
-
lessThanOrEqual(other: Weight): boolean;
|
|
24
22
|
isZero(): boolean;
|
|
25
23
|
toString(): string;
|
|
26
24
|
toJSON(): number;
|
package/dist/weight.vo.js
CHANGED
|
@@ -33,7 +33,7 @@ export class Weight {
|
|
|
33
33
|
}
|
|
34
34
|
subtract(other) {
|
|
35
35
|
const result = this.grams - other.grams;
|
|
36
|
-
return new Weight(WeightGrams.parse(
|
|
36
|
+
return new Weight(WeightGrams.parse(Math.max(0, result)), this.rounding);
|
|
37
37
|
}
|
|
38
38
|
multiply(factor) {
|
|
39
39
|
const grams = this.rounding.round(this.grams * factor);
|
|
@@ -49,15 +49,9 @@ export class Weight {
|
|
|
49
49
|
greaterThan(other) {
|
|
50
50
|
return this.grams > other.grams;
|
|
51
51
|
}
|
|
52
|
-
greaterThanOrEqual(other) {
|
|
53
|
-
return this.grams >= other.grams;
|
|
54
|
-
}
|
|
55
52
|
lessThan(other) {
|
|
56
53
|
return this.grams < other.grams;
|
|
57
54
|
}
|
|
58
|
-
lessThanOrEqual(other) {
|
|
59
|
-
return this.grams <= other.grams;
|
|
60
|
-
}
|
|
61
55
|
isZero() {
|
|
62
56
|
return this.grams === 0;
|
|
63
57
|
}
|